Disabled TextBox

Discussion in 'ASP .Net' started by =?Utf-8?B?VG90eSBTYW50YW5h?=, Sep 27, 2006.

  1. i have a textbox server control whos value is being changed using javascript.
    when the text is changes and i post back to the server the Text change is
    not reflected, instead i get blank string.
    if the TextBox enabled property is set to true , everything works fine.
    any ideas?
    thanks in advance
     
    =?Utf-8?B?VG90eSBTYW50YW5h?=, Sep 27, 2006
    #1
    1. Advertising

  2. =?Utf-8?B?VG90eSBTYW50YW5h?=

    Mark Rae Guest

    "Toty Santana" <> wrote in message
    news:...

    >i have a textbox server control whos value is being changed using
    >javascript.
    > when the text is changes and i post back to the server the Text change is
    > not reflected, instead i get blank string.
    > if the TextBox enabled property is set to true , everything works fine.
    > any ideas?


    Yep - this is, ahem, "standard" behaviour... :)

    Thankfully, the solution is simple enough, though: don't set the textbox
    readonly property in the HTML markup - do it in code instead. E.g.

    Don't do this:
    <asp:TextBox = ID="MyTextBox" runat="server" Enabled="false" />

    Do this instead:
    <asp:TextBox = ID="MyTextBox" runat="server" />

    And in the page's Page_Load event, do this:
    MyTextBox.Attributes.Add("disabled", "true");


    It's the same with the readonly attribute...
     
    Mark Rae, Sep 27, 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. =?Utf-8?B?QW5kcsOpcyBPcnTDrXo=?=

    Disabled copy paste in TExtBox

    =?Utf-8?B?QW5kcsOpcyBPcnTDrXo=?=, Jun 8, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    1,827
    willow
    Jun 9, 2005
  2. PJ6
    Replies:
    2
    Views:
    657
  3. Replies:
    4
    Views:
    7,949
  4. hal
    Replies:
    1
    Views:
    1,299
    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:
    476
    Jesse Houwing
    Jul 9, 2006
Loading...

Share This Page