(Found) the easiest way to bind dropdownlist in the gridview !!

Source: Internet
Author: User
Many people are asking how to bind dropdownlist in the <itemtemplate> In the gridview, that is, to read the Database Value and bind it to the dropdownlist control in the templatefield. I searched the internet for the write method in rowcreate or the BIND of the second read database field. simpler Method:
</ASP: templatefield>
<Asp: templatefield headertext = "locked?">
<Itemtemplate>
<Asp: dropdownlist id = "islock" runat = "server" Selectedvalue = <% # eval ("cateislock") %>>
<Asp: listitem text = "yes" value = "true"> </ASP: listitem>
<Asp: listitem text = "no" value = "false"> </ASP: listitem>
</ASP: dropdownlist>
</Itemtemplate>
</ASP: templatefield>
</Columns>

Note: The selectvalue attribute cannot be displayed on the ASPX page. If it is mandatory, it will be OK !!
Passed in vs2008 team suit + ACCESS !!

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.