<p>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.</p>

<p>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?</p>

<p>Code sample:</p>

<pre><code>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
}
</code></pre>

[{'answer_id': 79791, 'author': 'Nathan Feger', 'author_id': 8563, 'author_profile': 'https://Stackoverflow.com/users/8563', 'pm_score': 1, 'selected': False, 'text': '<p>Are you able to manage permissions on this database?  Would adding a separate user who only has read access to a database be sufficient for this type of scenario?  This could be a read-only user on the main database, but is only effectively used on the snapshot db.</p>\n\n<p>i.e. Add a new user, readerMan5000 who is only given select access, to the database in question.  Then require users to authenticate through that new credential.</p>\n\n<p>Note to future commenters, you may want to read: \n<a href="http://www.simple-talk.com/sql/database-administration/sql-server-2005-snapshots/" rel="nofollow noreferrer">http://www.simple-talk.com/sql/database-administration/sql-server-2005-snapshots/</a>\nor \n<a href="http://msdn.microsoft.com/en-us/library/ms187054(SQL.90).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ms187054(SQL.90).aspx</a>\nbefore you open your big mouth like me. :)</p>\n'}, {'answer_id': 215786, 'author': 'Brent Ozar', 'author_id': 26837, 'author_profile': 'https://Stackoverflow.com/users/26837', 'pm_score': 0, 'selected': False, 'text': "<p>You can't change permissions after you take the snapshot, but here's one workaround: instead of having them access the tables directly, require them to use views instead.  If the views are used only for reporting, then you can set tight security on them in the original database, and then have the users hit those views in the snapshot.  You'll need to restrict access on the underlying tables though if you want it to be effective.</p>\n"}]
['https://Stackoverflow.com/questions/78847', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/710/']