Gridview rowupdating dropdownlist selectedvalue Chat cam online egypt
But when the gridview is in edit mode, the dropdown lists comes in place of that labels. I want to set the selected values of drop down lists to the values of labels. Wherever you are binding your Grid View, in Page_Load for instance, you need to do this: On a slightly unrelated note, you can actually use the Grid View Update Event Args parameter that's passed to that method to grab the updated values (rather than using Find Control to get the Drop Down List, and then getting the values). Thus, your Grid View re-binds, and you get default values in your Row Updating event (rather than what you selected).Also since I'm dealing with a Drop Down List, I supposes my code [in VB} should look like: Dim index As Integer = Grid View1. Rows(index)Dim ddl_state_id As Drop Down List =CType(row. Selected Value"), Drop Down List)Dim ddl_state_desc As Drop Down List =CType(row.
So, I guess I should have know the answer to why the following does not work.
When I click the edit button, the Country display changes to a dropdown list but the selected Country is not 'Canada' but the first value in the datasource.
Is there a way to set the selected value in Edit Item Template so that its value in dropdown list matches the value originally displayed in the Item Template. Handle your Selected Index Changed event and something like this should work: //Bind the grid then Label lb = (Label)Grid View1.
About Data Value Field, yes you are right it should be primary key.
Selected Value or Selected Text, so that I can assign some value to them.