Visual Studio 2012 (Webforms)
When you have a DropDownList in a ListView bound to a database value, and you then switch the listview to edit mode the value in the dropdownlist changes from its datasource correct value to its first data item in its own list, this is a known error
What I want to do is when the listview enters edit mode is to find the dropdownlist and change its selected value with the correct database value again
I have tried for many many hours searching on google, but can not get the value to update
I have tried the listview itemediting event, the listview itemdatabound event, and dropdownlist databound event
For example:-
In listview itemdatabound event used the following code
DropDownList ddl = (DropDownList)e.Item.FindControl("DropDownList1");
ddl.SelectedValue = "Gary";
Seems to find the object as no null exception, but does not update value
Any help much appreciated, thanks