Professional Web Applications Themes

ASP:TextBox - ASP.NET General

I am a newbie to ASP.NET... What I was trying to do... but yet to succeed in... I am building a customer info database... and on default, I want to display the customer's basic information in the TextBox on Page_Load... but, also allow user to update the information For example: Street1 of the home address ASP:TextBox id=dbStreet1 value=<%=litDbStreet1%> but also allow update all within the same form on the same text box to do the following... ASP:TextBox id=dbStreet1 runat=server I tried everything I know... but not works... Please advise thanks Alex...

  1. #1

    Default ASP:TextBox

    I am a newbie to ASP.NET...

    What I was trying to do... but yet to succeed in...

    I am building a customer info database... and on default,
    I want to display the customer's basic information in the
    TextBox on Page_Load... but, also allow user to update the
    information

    For example: Street1 of the home address
    ASP:TextBox id=dbStreet1 value=<%=litDbStreet1%>

    but also allow update all within the same form on the same
    text box to do the following...
    ASP:TextBox id=dbStreet1 runat=server

    I tried everything I know... but not works...

    Please advise
    thanks
    Alex
    Alex Guest

  2. #2

    Default Re: ASP:TextBox

    Try the attribute "text" instead of "value".

    The best way to do this is declare an ASP textbox in the code-behind page
    and assign the value of the variable to dbStreet1.Text from the Page_Load
    event.

    George Zacharias.

    "Alex" <alexcfwugwu.edu> wrote in message
    news:006801c34307$06628da0$a101280aphx.gbl...
    > I am a newbie to ASP.NET...
    >
    > What I was trying to do... but yet to succeed in...
    >
    > I am building a customer info database... and on default,
    > I want to display the customer's basic information in the
    > TextBox on Page_Load... but, also allow user to update the
    > information
    >
    > For example: Street1 of the home address
    > ASP:TextBox id=dbStreet1 value=<%=litDbStreet1%>
    >
    > but also allow update all within the same form on the same
    > text box to do the following...
    > ASP:TextBox id=dbStreet1 runat=server
    >
    > I tried everything I know... but not works...
    >
    > Please advise
    > thanks
    > Alex

    George Zacharias Guest

  3. #3

    Default Re: ASP:TextBox

    Hi,

    This is what I did...

    Page_Load()
    dbStreet1.Text = "whatever st"

    Update_Text()
    SQL update cmd ==> "update ..... dbstreet1='" &
    dbStreet1.Text "' where <match critera>=<match this>"

    Inside the HTML Main Body
    <form method=post>
    <ASP:TextBox id=dbStreet1 value=dbStreet1.Text
    runat=server/>
    </form>

    It works on initial load.. where it takes the info from
    DB... but the update doesn't seem to regonize the new value

    Any clue?
    thanks
    Alex
    >-----Original Message-----
    >Try the attribute "text" instead of "value".
    >
    >The best way to do this is declare an ASP textbox in the
    code-behind page
    >and assign the value of the variable to dbStreet1.Text
    from the Page_Load
    >event.
    >
    >George Zacharias.
    >
    >"Alex" <alexcfwugwu.edu> wrote in message
    >news:006801c34307$06628da0$a101280aphx.gbl...
    >> I am a newbie to ASP.NET...
    >>
    >> What I was trying to do... but yet to succeed in...
    >>
    >> I am building a customer info database... and on
    default,
    >> I want to display the customer's basic information in
    the
    >> TextBox on Page_Load... but, also allow user to update
    the
    >> information
    >>
    >> For example: Street1 of the home address
    >> ASP:TextBox id=dbStreet1 value=<%=litDbStreet1%>
    >>
    >> but also allow update all within the same form on the
    same
    >> text box to do the following...
    >> ASP:TextBox id=dbStreet1 runat=server
    >>
    >> I tried everything I know... but not works...
    >>
    >> Please advise
    >> thanks
    >> Alex
    >
    >
    >.
    >
    Alex Guest

  4. #4

    Default Re: ASP:TextBox

    Hi,

    This is what I did...

    Page_Load()
    dbStreet1.Text = "whatever st"

    Update_Text()
    SQL update cmd ==> "update ..... dbstreet1='" &
    dbStreet1.Text "' where <match critera>=<match this>"

    Inside the HTML Main Body
    <form method=post>
    <ASP:TextBox id=dbStreet1 value=dbStreet1.Text
    runat=server/>
    </form>

    It works on initial load.. where it takes the info from
    DB... but the update doesn't seem to regonize the new value

    Any clue?
    thanks
    Alex
    >-----Original Message-----
    >Try the attribute "text" instead of "value".
    >
    >The best way to do this is declare an ASP textbox in the
    code-behind page
    >and assign the value of the variable to dbStreet1.Text
    from the Page_Load
    >event.
    >
    >George Zacharias.
    >
    >"Alex" <alexcfwugwu.edu> wrote in message
    >news:006801c34307$06628da0$a101280aphx.gbl...
    >> I am a newbie to ASP.NET...
    >>
    >> What I was trying to do... but yet to succeed in...
    >>
    >> I am building a customer info database... and on
    default,
    >> I want to display the customer's basic information in
    the
    >> TextBox on Page_Load... but, also allow user to update
    the
    >> information
    >>
    >> For example: Street1 of the home address
    >> ASP:TextBox id=dbStreet1 value=<%=litDbStreet1%>
    >>
    >> but also allow update all within the same form on the
    same
    >> text box to do the following...
    >> ASP:TextBox id=dbStreet1 runat=server
    >>
    >> I tried everything I know... but not works...
    >>
    >> Please advise
    >> thanks
    >> Alex
    >
    >
    >.
    >
    Alex Guest

  5. #5

    Default Re: ASP:TextBox

    Alex,

    You have to read some fundamental books on ASPX programming - that's #1.
    There are bunches and bunches of inexpensive, quick, easy books on the
    subject.

    The Page_load event fires on every trip to your page, so you are overwriting
    the data changed on the site with the Page_Load event assignments.
    .... so, your fresh, new values are led on when you post back to
    update...

    events fired in this order:

    Init
    Load viewstate
    Process postback data (this is where your new data gets back to the
    application)
    Load (this is were you lose the data, and the original values are put back)
    Send postback Change
    Postback events
    pre-render
    save view state
    render
    dispose
    unload

    Learn it, love it, live it! :-)

    "Alex" <alexcfwugwu.edu> wrote in message
    news:006801c34307$06628da0$a101280aphx.gbl...
    > I am a newbie to ASP.NET...
    >
    > What I was trying to do... but yet to succeed in...
    >
    > I am building a customer info database... and on default,
    > I want to display the customer's basic information in the
    > TextBox on Page_Load... but, also allow user to update the
    > information
    >
    > For example: Street1 of the home address
    > ASP:TextBox id=dbStreet1 value=<%=litDbStreet1%>
    >
    > but also allow update all within the same form on the same
    > text box to do the following...
    > ASP:TextBox id=dbStreet1 runat=server
    >
    > I tried everything I know... but not works...
    >
    > Please advise
    > thanks
    > Alex

    David Waz... Guest

  6. #6

    Default Re: ASP:TextBox

    Dave,

    Many thanks...

    The sequence of load instructions solve my problem...
    Basically I have everything else done right... Except, not
    checking explicitly for POST during Page_Load...

    I was basically counting on the even handler to trigger
    the event..

    Thank you
    Alex
    >-----Original Message-----
    >Alex,
    >
    >You have to read some fundamental books on ASPX
    programming - that's #1.
    >There are bunches and bunches of inexpensive, quick, easy
    books on the
    >subject.
    >
    >The Page_load event fires on every trip to your page, so
    you are overwriting
    >the data changed on the site with the Page_Load event
    assignments.
    >.... so, your fresh, new values are led on when you
    post back to
    >update...
    >
    >events fired in this order:
    >
    >Init
    >Load viewstate
    >Process postback data (this is where your new data gets
    back to the
    >application)
    >Load (this is were you lose the data, and the original
    values are put back)
    >Send postback Change
    >Postback events
    >pre-render
    >save view state
    >render
    >dispose
    >unload
    >
    >Learn it, love it, live it! :-)
    >
    >"Alex" <alexcfwugwu.edu> wrote in message
    >news:006801c34307$06628da0$a101280aphx.gbl...
    >> I am a newbie to ASP.NET...
    >>
    >> What I was trying to do... but yet to succeed in...
    >>
    >> I am building a customer info database... and on
    default,
    >> I want to display the customer's basic information in
    the
    >> TextBox on Page_Load... but, also allow user to update
    the
    >> information
    >>
    >> For example: Street1 of the home address
    >> ASP:TextBox id=dbStreet1 value=<%=litDbStreet1%>
    >>
    >> but also allow update all within the same form on the
    same
    >> text box to do the following...
    >> ASP:TextBox id=dbStreet1 runat=server
    >>
    >> I tried everything I know... but not works...
    >>
    >> Please advise
    >> thanks
    >> Alex
    >
    >
    >.
    >
    Alex Guest

  7. #7

    Default Re: ASP:TextBox


    This event sequence, indeed, is discussed in several
    ASP.NET with varying degrees of clarity. The major theme
    in most books is to use the "if (!IsPostBack)..." logic to
    get around the overwriting of variables in the viewstate.
    However, I am observing a difference in behavior between
    the asp:label control (where everything seems to work as I
    expect and state is preserved via the viewstate) and the
    asp:textbox where the state is not preserved in the
    viewstate. What is happening here? I think Alex and I
    are hitting the same problem.

    Also, the instance of the asp:textbox seems not to have
    been created in the init and when it is referenced in the
    Page_Load an exception is thrown because the object isn't
    there!

    What is happening with the asp:textbox?
    >-----Original Message-----
    >Alex,
    >
    >You have to read some fundamental books on ASPX
    programming - that's #1.
    >There are bunches and bunches of inexpensive, quick, easy
    books on the
    >subject.
    >
    >The Page_load event fires on every trip to your page, so
    you are overwriting
    >the data changed on the site with the Page_Load event
    assignments.
    >.... so, your fresh, new values are led on when you
    post back to
    >update...
    >
    >events fired in this order:
    >
    >Init
    >Load viewstate
    >Process postback data (this is where your new data gets
    back to the
    >application)
    >Load (this is were you lose the data, and the original
    values are put back)
    >Send postback Change
    >Postback events
    >pre-render
    >save view state
    >render
    >dispose
    >unload
    >
    >Learn it, love it, live it! :-)
    >
    >"Alex" <alexcfwugwu.edu> wrote in message
    >news:006801c34307$06628da0$a101280aphx.gbl...
    >> I am a newbie to ASP.NET...
    >>
    >> What I was trying to do... but yet to succeed in...
    >>
    >> I am building a customer info database... and on
    default,
    >> I want to display the customer's basic information in
    the
    >> TextBox on Page_Load... but, also allow user to update
    the
    >> information
    >>
    >> For example: Street1 of the home address
    >> ASP:TextBox id=dbStreet1 value=<%=litDbStreet1%>
    >>
    >> but also allow update all within the same form on the
    same
    >> text box to do the following...
    >> ASP:TextBox id=dbStreet1 runat=server
    >>
    >> I tried everything I know... but not works...
    >>
    >> Please advise
    >> thanks
    >> Alex
    >
    >
    >.
    >
    Leonard Guest

Similar Threads

  1. TextBox Value
    By Simon Abolnar in forum ASP.NET Data Grid Control
    Replies: 3
    Last Post: April 26th, 05:44 PM
  2. textbox.value
    By Samuel Kim in forum ASP.NET Data Grid Control
    Replies: 0
    Last Post: March 8th, 11:46 PM
  3. New TextBox value ignored
    By Andy Ogden in forum ASP.NET General
    Replies: 0
    Last Post: July 29th, 11:07 AM
  4. Replies: 3
    Last Post: July 23rd, 07:32 AM
  5. Replies: 0
    Last Post: July 16th, 06:51 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139