Gridview rowupdating dropdownlist selectedvalue

Note: Before you proceed, make sure that you already know the basics of using the Grid View control and how to bind it with data as I will not include the details of doing edit,update or delete scenarios for this exercise.

gridview rowupdating dropdownlist selectedvalue-81

The 2nd and 3rd columns are Template Fields that contains a Label control within an .

This means that on read-only state the Label will be displayed and on edit-state the Drop Down List will be displayed to allow users to modify the selection of their choice.

In this demo we will show a list of Product orders in Grid View and when the user edits the row, we will present the user with a Drop Down List containing the list of available Makes of products.

Once they have made their selection, we will populate the second Drop Down List with the available Models for the specific Make they've chosen.

We will use this as our Data Source in the Grid View later.

The Get Product Makes() method gets all the available Makes which in this case we just added 3 main items on it.Finally, the last column is a Command Field with Show Edit Button enabled.This will generate the Edit link when the Grid View is bounded with data. This is where we store the list of Makes of the product.Note that you need to set Auto Post Back to TRUE for the Drop Down List to trigger the Selected Index Changed event.The 4th and 5th columns are Bound Fields which holds the Price and Quantity fields.Now let’s go ahead do the highlight of this exercise (which is the implementation of the cascading dropdownlist).

Tags: , ,