Not getting correct Text of textbox

Bucky

Contributor
Joined
Dec 23, 2001
Messages
791
Location
East Coast
I have a web form with two asp:TexBox controls, txtSubject and
txtMessage, and txtMessage is multilined.

If, in Page_Load, I set the Text property of either of these boxes,
no matter what the user enters, the Text property always returns
what was set in Page_Load.

If I don't set a value for a box in Page_Load, the Text property
retrieves the "correct" value.

What am I missing here? :confused:
 
Yes, the problem is a bit similar, only I am changing the textbox values in the code-behind file in Page_Load, not in JavaScript.

I tried setting EnableViewState for both the boxes and the web
form to False, but the same problem still occurs.

And LOL at that thread title. :)

[edit]Another thing if it helps... the TextChanged event does not seem
to fire on either of the boxes, whether they end up returning
the correct value or not[/edit]
 
Last edited:
Boy I feel dumb... Now that I understand ASP.NET concepts
much more, I just recently looked back at that project and
realized I was changing the Textbox's text in the Page's Load
event without checking to see if IsPostBack was false first.

When I hit the button, the Load event would fire, changing the
text back to what it was originally, and then of course when the
code came to handle the text in the button's Click event, the
text was not what the user typed in.

Thanks anyway for your help, Thinker. :)
 
Back
Top