TextBox - no value if disabled?

Discussion in 'ASP .Net' started by matt@mailinator.com, Jul 27, 2006.

  1. Guest

    hello,

    is it expected behavior (in 1.1) for a disabled=true textbox to *not*
    maintain its value upon postback?

    if so, this is disappointing. often times in my app i need to "lock"
    textboxes, reserving them for automated javascript entry only, not
    manual. but id still like to pick up their values on postback.

    i have work arounds i can employ, but i wanted to confirm this
    behavior.


    thanks,
    matt
    , Jul 27, 2006
    #1
    1. Advertising

  2. Arthur Dent Guest

    Is it something that the user is supposed to see? Or not.

    Usually if i have values i want to hide from the user, i will use the
    following:
    <input type=""hidden" id="hdnMyValue" runat="server" >
    (in 2.0 there is actually an asp Hidden control type)
    If you do want the user to see the box, then instead of disabling it, you
    could set it to be ReadOnly.

    How are you coding your textbox? Are your using
    <asp:textbox id=txtMyBox runat=server enabled=false />
    or are you using
    <input type=textbox disabled=true />


    <> wrote in message
    news:...
    > hello,
    >
    > is it expected behavior (in 1.1) for a disabled=true textbox to *not*
    > maintain its value upon postback?
    >
    > if so, this is disappointing. often times in my app i need to "lock"
    > textboxes, reserving them for automated javascript entry only, not
    > manual. but id still like to pick up their values on postback.
    >
    > i have work arounds i can employ, but i wanted to confirm this
    > behavior.
    >
    >
    > thanks,
    > matt
    >
    Arthur Dent, Jul 27, 2006
    #2
    1. Advertising

  3. sloan Guest

    I'd concur that

    ReadOnly on the textbox
    and/or a
    <asp:hidden>

    are the 2 options for handling this.

    <> wrote in message
    news:...
    > hello,
    >
    > is it expected behavior (in 1.1) for a disabled=true textbox to *not*
    > maintain its value upon postback?
    >
    > if so, this is disappointing. often times in my app i need to "lock"
    > textboxes, reserving them for automated javascript entry only, not
    > manual. but id still like to pick up their values on postback.
    >
    > i have work arounds i can employ, but i wanted to confirm this
    > behavior.
    >
    >
    > thanks,
    > matt
    >
    sloan, Jul 27, 2006
    #3
  4. Patrice Guest

    Yes, this is a browser side behavior (AFAIK likely accross most browsers).
    The (bad ?) idea is likely that if the control is disabled you can't change
    the value and consequently there is no need to post this (unchanged) value
    to the server (probably designed this way back to low bandwidth/ no
    javascript days)...

    --
    Patrice

    <> a écrit dans le message de news:
    ...
    > hello,
    >
    > is it expected behavior (in 1.1) for a disabled=true textbox to *not*
    > maintain its value upon postback?
    >
    > if so, this is disappointing. often times in my app i need to "lock"
    > textboxes, reserving them for automated javascript entry only, not
    > manual. but id still like to pick up their values on postback.
    >
    > i have work arounds i can employ, but i wanted to confirm this
    > behavior.
    >
    >
    > thanks,
    > matt
    >
    Patrice, Jul 27, 2006
    #4
  5. Guest

    Patrice wrote:
    > Yes, this is a browser side behavior (AFAIK likely accross most browsers).
    > The (bad ?) idea is likely that if the control is disabled you can't change
    > the value and consequently there is no need to post this (unchanged) value
    > to the server (probably designed this way back to low bandwidth/ no
    > javascript days)...


    ah, this is what i was looking for. as i mentioned i have work arounds,
    but i wanted to make sure this was unchangeable behavior.


    thanks,
    matt
    , Jul 28, 2006
    #5
    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. =?Utf-8?B?QW5kcsOpcyBPcnTDrXo=?=

    Disabled copy paste in TExtBox

    =?Utf-8?B?QW5kcsOpcyBPcnTDrXo=?=, Jun 8, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    1,824
    willow
    Jun 9, 2005
  2. PJ6
    Replies:
    2
    Views:
    654
  3. =?Utf-8?B?VG90eSBTYW50YW5h?=

    Disabled TextBox

    =?Utf-8?B?VG90eSBTYW50YW5h?=, Sep 27, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    413
    Mark Rae
    Sep 27, 2006
  4. hal
    Replies:
    1
    Views:
    1,294
    Alexey Smirnov
    May 21, 2008
  5. M O J O

    Disabled textbox is nothing on postback :o(

    M O J O, Jun 29, 2006, in forum: ASP .Net Building Controls
    Replies:
    4
    Views:
    469
    Jesse Houwing
    Jul 9, 2006
Loading...

Share This Page