How to retrieve a modified value from the databound text box in DataGrid


ASP.NET 1.1 - I have a datagrid on an aspx page that is databound and displays a value within a textbox. The user is able to change this value, then click on a button where the code behind basically iterates through each DataGridItem in the grid, does a FindControl for the ID of the textbox then assigns the .Text value to a variable which is then used to update the database. The datagrid is rebound with the new values.

The issue I'm having is that when assigning the .Text value to the variable, the value being retrieved is the original databound value and not the newly entered user value. Any ideas as to what may be causing this behaviour?

Code sample:

foreach(DataGridItem dgi in exGrid.Items)
            TextBox Text1 = (TextBox)dgi.FindControl("TextID");
            string exValue = Text1.Text; //This is retrieving the original bound value not the newly entered value
            // do stuff with the new value


So the code sample is from your button click event?

Are you sure you are not rebinding your datasource on postback?