TextBox control not accepting Information typed in..

M

Mad Bull

I am a newbie. I have created a page which upon load connects to SQL
Server and runs a stored procedure. The data returned from this is
assigned to some asp:labels and asp:textbox controls.
This all works fine.
The user then updated the textbox controls and clicks an asp:button to
execute an event procedure. The event procedure is supposed to set some
session variables useing the information stored in the asp:textbox's
..Text property and call another webpage. Unfortunately, even though the
user has put information into the textbox, the .text property is
showing up as an empty string and that is what gets stored in the
Session Variable.
Why would this happen? How do I correct it?
 
R

Rob Meade

...
Why would this happen? How do I correct it?

Are you creating that text box programmitically in your code? If so,
perhaps this is happening regardless of a page postback, thus creating a new
control each time the page loads and therefore clearing any text that was in
it.

Regards

Rob
 
M

Mad Bull

Rob said:
...


Are you creating that text box programmitically in your code? If so,
perhaps this is happening regardless of a page postback, thus creating a new
control each time the page loads and therefore clearing any text that was in
it.

Regards

Rob

Lets see... the textbox control is set up in the aspx page, like this:

<asp:textbox id="v_ExtDirAdLine" columns="1000" width="301px"
runat="server"></asp:textbox>

In the aspx.vb page, there is a definition for the textbox, like this:

Protected WithEvents v_ExtDirAdLine as
System.Web.UI.WebControls.TextBox

The above definition is at the class level, rather than being within a
procedure.

Thats all there is for definition. I do set the value of the textbox in
the page_load procedure, and then I type in a value. It seems the value
that is set in the page_load is always kept... that may be the reason.
I will put the initialisation code into an "If Not PostBack Then" block
and see what happens...

Yes that was it! Thanks much...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top