I have a gridview, the contents of which are provided by accessdatasource the data displayed is dependant on a dropdown list which has a postback event
- The page loads
- User selects an item from the dropdown
- page reloads with new data in the gridview
So far so good
I have then added a textbox to the grid view (no I can't to use the standard "edit" link) The textbox is in a itemtemplate
this textbox contains editable data for the user to update and send back to the server with a click of the update button.
The problem is if I change the selection in the dropdown the gridview updates as it should but the textboxes retain the old value even though they are bound with <%# Bind("vr_total") %>
I can only assume that this is caused by the postback data and that the data is overwritten after the binding occurs. (otherwise the bind would overwrite the old unwanted data)
Can someone please explain how I can change this behaviour.
viewstate is set to false
I am new to .net and c#
DC
A further development..
If I replace the <asp:textbox with <input type="text" value="<%# Eval("vr_total") %>" ... > the grid works exactly as expected.
The problem appears to be the gridview populates its child controls when the data is bound but the textbox overwrites it with what was posted (via the postback event on the dropdown) even if its viewstate is disabled.