Enabled="False"

Discussion in 'ASP .Net Web Controls' started by Loren Dummer, Apr 12, 2006.

  1. Loren Dummer

    Loren Dummer Guest

    If I have a <asp:textbox control on a webform that is sometimes
    enabled="False" and sometimes Enabled="True". How can I still read the
    value of the textbox control when the enabled property is set to False? For
    some reason, if the Enabled property is set to True, I cannot read the text
    property of the textbox. It just returns "". I used to do this all the
    time in ASP 3.0 when the <input> control had the disbled command.
     
    Loren Dummer, Apr 12, 2006
    #1
    1. Advertising

  2. Loren Dummer

    Teemu Keiski Guest

    Hi,

    Basically, disabled controls won't submit their values to the server so
    after you do a postback (when disabled the control) the value is lost.
    See: http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.12.1

    If you use ASP.NET v2.0, you can make the form to submit disabled controls
    http://msdn2.microsoft.com/en-us/li...s.htmlform.submitdisabledcontrols(VS.80).aspx

    --
    Teemu Keiski
    ASP.NET MVP, AspInsider
    Finland, EU
    http://blogs.aspadvice.com/joteke

    "Loren Dummer" <> wrote in message
    news:...
    > If I have a <asp:textbox control on a webform that is sometimes
    > enabled="False" and sometimes Enabled="True". How can I still read the
    > value of the textbox control when the enabled property is set to False?
    > For some reason, if the Enabled property is set to True, I cannot read the
    > text property of the textbox. It just returns "". I used to do this all
    > the time in ASP 3.0 when the <input> control had the disbled command.
    >
     
    Teemu Keiski, Apr 16, 2006
    #2
    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. Gabor
    Replies:
    3
    Views:
    662
    Jacob Yang [MSFT]
    Aug 26, 2003
  2. Amar
    Replies:
    0
    Views:
    576
  3. Gill Smith
    Replies:
    4
    Views:
    8,918
    Gish Smith
    May 22, 2004
  4. Patrick.O.Ige
    Replies:
    7
    Views:
    9,764
    Rote Rote
    Apr 10, 2006
  5. elaine
    Replies:
    2
    Views:
    470
    Steve C. Orr [MCSD, MVP, CSM, ASP Insider]
    May 24, 2007
Loading...

Share This Page