TextBox control not accepting Information typed in..

Discussion in 'ASP .Net' started by Mad Bull, Jul 16, 2006.

  1. Mad Bull

    Mad Bull Guest

    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?
     
    Mad Bull, Jul 16, 2006
    #1
    1. Advertising

  2. Mad Bull

    Rob Meade Guest

    "Mad Bull" wrote ...

    > 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
     
    Rob Meade, Jul 17, 2006
    #2
    1. Advertising

  3. Mad Bull

    Mad Bull Guest

    Rob Meade wrote:
    > "Mad Bull" wrote ...
    >
    > > 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


    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...
     
    Mad Bull, Jul 17, 2006
    #3
  4. Mad Bull

    Rob Meade Guest

    "Mad Bull" wrote ...

    > Yes that was it! Thanks much...


    hehe, no worries :eek:)

    Rob
     
    Rob Meade, Jul 20, 2006
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Bogdan Zamfir

    Accepting date in Webform textbox

    Bogdan Zamfir, Aug 18, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    366
    Bogdan Zamfir
    Aug 18, 2003
  2. Ersin Gençtürk
    Replies:
    1
    Views:
    3,550
    Ersin Gençtürk
    Oct 6, 2004
  3. =?Utf-8?B?dGhlIGZyaWVuZGx5IGRpc3BsYXkgbmFtZQ==?=

    Accepting certain tags in a textbox

    =?Utf-8?B?dGhlIGZyaWVuZGx5IGRpc3BsYXkgbmFtZQ==?=, Nov 8, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    552
    Patrick.O.Ige
    Nov 8, 2005
  4. Sandeep Singh Sekhon

    Problem in Accepting Xml Data in TextBox

    Sandeep Singh Sekhon, Jul 6, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    1,049
    Walter Wang [MSFT]
    Jul 7, 2006
  5. Yingjie Lan
    Replies:
    4
    Views:
    340
    John Nagle
    Jan 29, 2010
Loading...

Share This Page