Invalid text field value

I have an asp.net page with a directory with several text fields and a submit button. when I am wrapping text in a text box and press submit, the value I get in vb code is the old value, not the one I just entered.

Any idea?

thanks

+4
source share
1 answer

There are two possible reasons for this.

Either (1) the part of your code that sets this value is triggered by postback, thereby reloading it, or (2) your text field is disabled in .NET code (and included in javascript), so .NET assumes that it the value cannot be changed and does not check POST data.

Sorry for the C # code examples, but I'm sure you will work it out:

one

if(!Page.IsPostBack) { myTextBox.Value = "original value"; } 

2

 string valueFromTextbox = Request.Form[myTextBox.ClientID]; 
+7
source

All Articles