We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Platform : ASP.NET
Category : DataGrid

How to use a dropdownlist in a DataGrid

Step 1: Display the Data in the Datagrid Initially the Datagrid is populated with the records in the db The field Discontinued is of data type bit in the db i.e 0/1.
To display it as yes/no in the Datagrid a helper function ShowVal(...) is called
Step 2: To Edit the Datagrid ,
When the edit button is clicked it should display field Discontinued as Yes/No
  • To update the record the user should get a choice to Select Yes/No using dropdownlist
  • By default the dropdownlist should be set to the value in the database
    • So the DataSource property of the dropdownlist is set to BindTheDiscontinued()
    • and OnPreRender property does the task of setting the value from the db to the dropdownlist
Code Behind VB.NET C#

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.