Use Cases to learn about. net WebForms (3)

Source: Internet
Author: User

DropDownList:
<Select...> in the Form element corresponding to DropDownList, we have two ways to define it.
<Asp: DropDownList id = "dropdownlist1" runat = "server">
<Asp: ListItem> Item 1 </asp: ListItem>
<Asp: ListItem> Item 2 </asp: ListItem>
<Asp: ListItem> Item 3 </asp: ListItem>
<Asp: ListItem> Item 4 </asp: ListItem>
</Asp: DropDownList>
Code definition method:
DropDownList dropdownlist1 = new DropDownList ();

The key features are as follows:
The SelectedItem attribute is a ListItem Class. Next we will explain this ListItem attribute.

ListItem attribute,

Because we are most concerned about DropDownList, we will get the result after selecting DropDownList.
Therefore, the attributes that we are most concerned about ListItem are the Text and Value attributes.
Text is the result of the ListItem display on the External table.
Value is the real Value of the selected Item.

To sum up, let's summarize the usage of the SelectedItem attribute of DropDownList.
Dropdownlist1.SelectedItem. Text and dropdownlist1.SelectedItem. Value


Related Article

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.