Hello, I have an asp.net page with a datalist with few textboxes, and a submit button. when i cahnge the text in the textbox, and click submit, the value i get in the vb code is the old value and not the one i just entered.
Any idea?
thanks
Hello, I have an asp.net page with a datalist with few textboxes, and a submit button. when i cahnge the text in the textbox, and click submit, the value i get in the vb code is the old value and not the one i just entered.
Any idea?
thanks
There are two possible reasons for this.
Either (1) the part of your code that sets this value is being run at postback, thus resetting it, or (2) your textbox is disabled in .NET code (and enabled in javascript) so that .NET assumes that its value cannot have changed, and doesn't check the POST data.
Sorry for C# code examples, but i'm sure you'll work it out:
if(!Page.IsPostBack) { myTextBox.Value = "original value"; }
string valueFromTextbox = Request.Form[myTextBox.ClientID];
please explain this answer I also faced with a similar issue. My TextBox doesn't show the new text assigned from the code. It shows the old text. This text box resides inside a web user control.