Custom Validation with client and server side functions

Discussion in 'ASP .Net' started by =?Utf-8?B?QW5kcmU=?=, Dec 28, 2004.

  1. I've set up a CustomValidator control which has both a client side and server
    side function associated with it. My server side function never seems to be
    called as long as I have the "EnableClientScript" property set to true. As
    soon as I set this property to false , my server side function is called and
    works fine. From reading the help, it was my understanding that the server
    side function should be called even if I have a client side script. What am
    I missing?

    I also read that the customValidator is not called if there is no data in
    the controlToValidate (textbox for example). Do people usually just assign
    two validators to the control? Is it possible to create your own custom
    control , derived from a "RequiredFieldValidator" that would also call a
    server side function?

    Thanks for the help.

    --
    Andre
    =?Utf-8?B?QW5kcmU=?=, Dec 28, 2004
    #1
    1. Advertising

  2. "Andre" <> wrote in message
    news:...
    > I've set up a CustomValidator control which has both a client side and
    > server
    > side function associated with it. My server side function never seems to
    > be
    > called as long as I have the "EnableClientScript" property set to true. As
    > soon as I set this property to false , my server side function is called
    > and
    > works fine. From reading the help, it was my understanding that the
    > server
    > side function should be called even if I have a client side script. What
    > am
    > I missing?
    >
    > I also read that the customValidator is not called if there is no data in
    > the controlToValidate (textbox for example). Do people usually just
    > assign
    > two validators to the control? Is it possible to create your own custom
    > control , derived from a "RequiredFieldValidator" that would also call a
    > server side function?


    I usually use a RequiredFieldValidator in addition to whatever other
    validators I need.

    John Saunders
    John Saunders, Dec 28, 2004
    #2
    1. Advertising

  3. Yes, you can use more than one validator on for a control, such as the
    RequiredFieldValidator and the CustomValidator.

    If your client side script determines the user's data is invalid, the page
    will never post back so your server side validation won't fire.
    If the client side script considers the data to be valid then the page
    should post back normally and your server side validatiton routine should be
    fired.

    --
    I hope this helps,
    Steve C. Orr, MCSD, MVP
    http://Steve.Orr.net



    "Andre" <> wrote in message
    news:...
    > I've set up a CustomValidator control which has both a client side and
    > server
    > side function associated with it. My server side function never seems to
    > be
    > called as long as I have the "EnableClientScript" property set to true. As
    > soon as I set this property to false , my server side function is called
    > and
    > works fine. From reading the help, it was my understanding that the
    > server
    > side function should be called even if I have a client side script. What
    > am
    > I missing?
    >
    > I also read that the customValidator is not called if there is no data in
    > the controlToValidate (textbox for example). Do people usually just
    > assign
    > two validators to the control? Is it possible to create your own custom
    > control , derived from a "RequiredFieldValidator" that would also call a
    > server side function?
    >
    > Thanks for the help.
    >
    > --
    > Andre
    >
    Steve C. Orr [MVP, MCSD], Dec 28, 2004
    #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,070
    Chad Z. Hower aka Kudzu
    Jan 30, 2004
  2. =?Utf-8?B?dmlkeWE=?=
    Replies:
    1
    Views:
    740
    Kevin Spencer
    Jun 2, 2005
  3. Boss302
    Replies:
    0
    Views:
    1,020
    Boss302
    Nov 21, 2006
  4. Bogdan
    Replies:
    2
    Views:
    637
    Bogdan
    Jun 9, 2008
  5. Zoe Hart
    Replies:
    1
    Views:
    345
    Scott Wisniewski
    Jan 8, 2004
Loading...

Share This Page