<p>I have several "ASP:TextBox" controls on a form (about 20).<br>
When the form loads, the text boxes are populated from a database.<br>
The user can change the populated values, and when they submit the form, I take the values posted to the server and conditionally save them (determined by some business logic).<br>
All but 1 of the text boxes work as intended.</p>

<p>The odd box out, upon postback, does not contain the updated value that the user typed into the box.<br>
When debugging the application, it is clear that <code>myTextBox.Text</code> reflects the old, pre-populated value, not the new, user-supplied value.<br>
Every other box properly shows their respective user-supplied values.</p>

<p>I did find a workaround.<br>
My solution was to basically extract the text box's value out of the <code>Request.Form</code> object:   <code>Request.Form[myTextBox.UniqueID]</code>, which does contain the user-supplied value.</p>

<p>What could be going on, here?<br>
As I mentioned, the other text boxes receive the user-supplied values just fine, and this particular problematic text box doesn't have any logic associated to it -- it just takes the value and saves it.<br>
The main difference between this text box and the others is that this is a multi-line box (for inputting notes), which I believe is rendered as an HTML "textarea" tag instead of an "input" tag in ASP.NET.</p>

[{'answer_id': 23007, 'author': 'Darren Kopp', 'author_id': 77, 'author_profile': 'https://Stackoverflow.com/users/77', 'pm_score': 4, 'selected': True, 'text': '<p>Are you initially loading the data only when !Page.IsPostBack? Also, is view state enabled for the text box?</p>\n'}, {'answer_id': 23012, 'author': 'FlySwat', 'author_id': 1965, 'author_profile': 'https://Stackoverflow.com/users/1965', 'pm_score': 1, 'selected': False, 'text': "<p>Remember the order of the page lifecycle, and where you are databinding your form.</p>\n\n<ul>\n<li>PreInit</li>\n<li>Init</li>\n<li>Load</li>\n<li>Your Control Event Handler</li>\n</ul>\n\n<p>If you are reading the value in the Control Event handler, yet databinding in Init or Load, you'll have the old value.</p>\n\n<p>The trick is to always databind in the correct event, or check for postback and don't databind then.</p>\n"}, {'answer_id': 23032, 'author': 'Rob Cooper', 'author_id': 832, 'author_profile': 'https://Stackoverflow.com/users/832', 'pm_score': 2, 'selected': False, 'text': '<p>I would second <a href="https://stackoverflow.com/questions/22988/form-post-doesnt-contain-textbox-data-aspnet-c#23012">Jonathan\'s response</a> I would check your databinding settings.</p>\n\n<p>If you do not need ViewState for the textboxes (i.e. no postback occurs until form submit) then you should disable it.</p>\n\n<p>It sounds like you are not having problems saving the data (since you said you have managed to get the control to read the <em>correct</em> data back). Therefore, I would say the problem loads in your databinding code.</p>\n'}, {'answer_id': 23058, 'author': 'Jon Erickson', 'author_id': 1950, 'author_profile': 'https://Stackoverflow.com/users/1950', 'pm_score': 3, 'selected': False, 'text': '<p>this happens to me all the time.</p>\n\n<pre><code>protected void Page_Load(object sender, EventArgs e)\n{\n    if (!Page.IsPostBack)\n    {\n        // populate text boxes from database\n    }\n}\n</code></pre>\n'}, {'answer_id': 28214, 'author': 'Darren Steinweg', 'author_id': 418, 'author_profile': 'https://Stackoverflow.com/users/418', 'pm_score': 1, 'selected': False, 'text': '<blockquote>\n  <p>Are you initially loading the data only when !Page.IsPostBack? Also, is view state enabled for the text box?</p>\n</blockquote>\n\n<p>I had almost forgotten to check the ViewState, but ended up remembering to verify that it wasn\'t disabled before making my post here on SO.  I even set EnableViewState="true" to make sure.</p>\n\n<p>I did find the solution, and it coincided with most of the answers here.  The form was indeed loading its data more than once (which is intentional behavior).  I implemented some special code for this field, and all is well.</p>\n\n<p>Thanks for your replies, all!</p>\n'}]
['https://Stackoverflow.com/questions/22988', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/418/']