clienside validation for user controls

Discussion in 'ASP .Net Building Controls' started by cplatzer@solus-software.de, Nov 29, 2005.

  1. Guest

    Hi,
    I have created a custom control that represents a date-input. It
    consists of a textbox and a button which opens a popup calendar.
    Now when I have two of those date-inputs, I want to ensure that the
    user doesn't enter a date in the second input that is smaller than that
    in the first. I am using a comparevalidator to compare these two user
    controls.
    I have added a property called Text which returns the tex-property of
    it's textbox and I have set <ValidationPropertyAttribute("Text")> in
    the class-Definition.
    However the validation only works server-side.
    I have read somewhere (sadly I don't find the text anymore) that
    clientside validation is only possible for controls that render their
    value on the html-page (which my control does since it's value is the
    value of a textbox ). However, the text didn't tell me how to tell the
    validator that it can do clientside validation with my control.

    Does anybody know how to do that?

    Thanks in advance,
    Christian
     
    , Nov 29, 2005
    #1
    1. Advertising

  2. Guest

    I just noticed that my problem seems to be even bigger:

    The server-side validation doesn't really work either:
    When I enter wrong dates and then do a postback the message of the
    validator is shown BUT I can still press any button on the page and
    they still work like no error was present.

    I don't have any problems with validators that directly validate
    textboxes, thoug...
     
    , Nov 29, 2005
    #2
    1. Advertising

  3. cplatzer,
    With Validator we wont be able to do client side script. Add th
    script event to the server control like
    srvContrlname.Attributes.Add("onClick","javascript:Test();");

    "" wrote:

    > Hi,
    > I have created a custom control that represents a date-input. It
    > consists of a textbox and a button which opens a popup calendar.
    > Now when I have two of those date-inputs, I want to ensure that the
    > user doesn't enter a date in the second input that is smaller than that
    > in the first. I am using a comparevalidator to compare these two user
    > controls.
    > I have added a property called Text which returns the tex-property of
    > it's textbox and I have set <ValidationPropertyAttribute("Text")> in
    > the class-Definition.
    > However the validation only works server-side.
    > I have read somewhere (sadly I don't find the text anymore) that
    > clientside validation is only possible for controls that render their
    > value on the html-page (which my control does since it's value is the
    > value of a textbox ). However, the text didn't tell me how to tell the
    > validator that it can do clientside validation with my control.
    >
    > Does anybody know how to do that?
    >
    > Thanks in advance,
    > Christian
    >
    >
     
    Santhi Maadhaven, Dec 1, 2005
    #3
    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. Matt
    Replies:
    14
    Views:
    4,144
    Chad Z. Hower aka Kudzu
    Jan 30, 2004
  2. =?Utf-8?B?ZGh1cndpdHo=?=
    Replies:
    1
    Views:
    477
    Teemu Keiski
    Apr 10, 2004
  3. baroque Chou
    Replies:
    4
    Views:
    445
    Peter Blum
    Jan 24, 2006
  4. Faizan Ahmed
    Replies:
    1
    Views:
    302
    John Saunders
    Jan 4, 2005
  5. Faizan Ahmed
    Replies:
    1
    Views:
    378
    John Saunders
    Jan 4, 2005
Loading...

Share This Page