Each row of data in the GridView has a selection, which displays only values in its normal state, and after clicking on the edited button, the status is switched to a drop-down box for the user to modify.
Now these are all in good condition, including clicking on the edit to automatically select the current item, using the Onrowcreated method, creating a data table will generate binding events, including when the click Edit.
Now the question is coming.
Because there is only one DropDownList control tag in the ASPX page, the data is provided by the. CS, which means that the data is bound dynamically when the Drop-down control is bound. The problem with this is that when you click the "Update" button, you can't get the value of the Drop-down control, and if the selection is written to die on the page, you can take it.
Now, how do you solve the dynamic binding of data and the value of this dynamically bound Drop-down when you click update?
Workaround:
dropdownlist dl = (DropDownList) gridview1.items[i]. FindControl ("DL1");
for (int f = 0; f < dl. Items.Count; f++)
{
& nbsp if (DL. ITEMS[F]. Selected)
{
& nbsp Label1.Text + = dl. ITEMS[F]. Text;
}
}