How do I validate a ReadOnly Textbox using the RequiredFieldValida

Discussion in 'ASP .Net' started by =?Utf-8?B?SWFu?=, Nov 2, 2006.

  1. I have an ASP.NET 2.0 page with a readonly textbox on it who's value is
    populated by a popup child window used for selecting from a list. I use a
    javascript function to pass the data back to the parent using the name of the
    textbox with the parent form. This all works fine, except when I click Save
    on the Parent form and require the client side RequiredFieldValidator to
    trigger. This validator results in showing the error message pertaining to
    the fact that the readonly textbox is empty

    Any ideas

    Much appreciated
    Ian
    =?Utf-8?B?SWFu?=, Nov 2, 2006
    #1
    1. Advertising

  2. To get around this I have used this code in the Page_Load event

    txtTextbox.Attributes.Add("readonly", "true");

    However, this appears to be a dirty hack to me

    Is there another solution?

    "Ian" wrote:

    > I have an ASP.NET 2.0 page with a readonly textbox on it who's value is
    > populated by a popup child window used for selecting from a list. I use a
    > javascript function to pass the data back to the parent using the name of the
    > textbox with the parent form. This all works fine, except when I click Save
    > on the Parent form and require the client side RequiredFieldValidator to
    > trigger. This validator results in showing the error message pertaining to
    > the fact that the readonly textbox is empty
    >
    > Any ideas
    >
    > Much appreciated
    > Ian
    =?Utf-8?B?SWFu?=, Nov 2, 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. doug albright
    Replies:
    0
    Views:
    460
    doug albright
    Aug 30, 2003
  2. Angela Chen
    Replies:
    3
    Views:
    9,023
    parshuram
    Dec 6, 2004
  3. Replies:
    4
    Views:
    923
    Zoe Brown
    Sep 12, 2005
  4. =?Utf-8?B?SmltIEhlYXZleQ==?=

    Textbox Readonly

    =?Utf-8?B?SmltIEhlYXZleQ==?=, Jun 30, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    560
    =?Utf-8?B?SmltIEhlYXZleQ==?=
    Jun 30, 2005
  5. Jonathan Hyatt
    Replies:
    1
    Views:
    1,861
    Jonathan Hyatt
    Jun 8, 2004
Loading...

Share This Page