The selecteditem of dropdownlist cannot get the selected value due to improper datavaluefield settings.

Source: Internet
Author: User

Selecteditem of dropdownlist takes the selected value. No matter what you select, it is always the value of the first listitem.

For example:

Dropdownlist1

Datatextfield datavaluefield

Test1 value1

Test2 value1

Test3 value1

Dropdownlist1 no matter which value you choose dropdownlist1.selecteditem. Text is test1

I finally found out that it was caused by this reason.
When binding dropdownlist data, datavaluefield and datatextfield are set.
Because datavaluefield has the same value, no matter which listitem you choose after submitting the webpage
Selecteditem obtains the same value. In. net, the selecteditem may be determined based on datavaluefield.
Although datatextfield is different, as long as they are the same datavaluefield,. Net considers them to be the same value.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.