Appenddatabounditems. dropdownlist added in Asp.net 2.0 add the first item

Source: Internet
Author: User

In Asp.net 2.0, an appenddatabounditems attribute is added, which is very convenient and allows you to add items to the listcontrol object before binding data. After data binding is executed, the item set contains items in the data source and previously added items. True if the list items are not cleared before data binding; false if the items set is cleared before data binding is executed. The default value is false. For example

  <  ASP: dropdownlist  ID  = "Dropdownlist1"  Appenddatabounditems  = "True"  Runat  = "Server"  Performanceid  = "Sqlperformance1" Datatextfield  = "State"  Datavaluefield  = "State"  >  <  ASP: listitem  Text  = "(Select a State )"  Value  = ""  />  </  ASP: dropdownlist  >  < ASP: sqldatasource  ID  = "Sqlperformance1"  Runat  = "Server"  Connectionstring  = "<% $ Connectionstrings: pubsconnectionstring %>"  Selectcommand  = "Select distinct [State] from [authors]"  >  </  ASP: sqldatasource  > 

A prompt is added for the first item of dropdownlist, which requires the user to select. It does not disappear after being bound to sqldatasource or other data sources.

http://tech.sina.com.cn/s/s/2008-06-18/1211698093.shtml

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.