Jump to content
Xtreme .Net Talk

Recommended Posts

  • *Experts*
Posted

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:

"Being grown up isn't half as fun as growing up

These are the best days of our lives"

-The Ataris, In This Diary

  • *Experts*
Posted (edited)

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]

Edited by Bucky

"Being grown up isn't half as fun as growing up

These are the best days of our lives"

-The Ataris, In This Diary

  • 2 months later...
  • *Experts*
Posted

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. :)

"Being grown up isn't half as fun as growing up

These are the best days of our lives"

-The Ataris, In This Diary

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...