Client side validation in asp.net forms

Discussion in 'ASP .Net' started by Guest, Mar 1, 2004.

  1. Guest

    Guest Guest

    Hi

    Has anyone any experience using client side validation with asp.net forms.

    Specifically I'd like to know...

    1. How do you attach client side code web controls (a button), like a
    JavaScript 'onclick' event for example?
    2. Any issues anyone has experienced using client side validation with
    asp.net forms?

    Thanks in advance

    Simon Ames
    Guest, Mar 1, 2004
    #1
    1. Advertising

  2. Guest

    Krishnan Guest

    All validator controls run on the client side unless scripting in the client
    browser is switched off. Hence using validator controls will be equivalent
    to writing "Onclick" event code on the client side.


    Krishnan

    <> wrote in message
    news:eYBjmJ3$...
    > Hi
    >
    > Has anyone any experience using client side validation with asp.net forms.
    >
    > Specifically I'd like to know...
    >
    > 1. How do you attach client side code web controls (a button), like a
    > JavaScript 'onclick' event for example?
    > 2. Any issues anyone has experienced using client side validation with
    > asp.net forms?
    >
    > Thanks in advance
    >
    > Simon Ames
    >
    >
    Krishnan, Mar 1, 2004
    #2
    1. Advertising

  3. Hi Simon,

    Like you normally write a javascript and place it in regular place.
    Only thing you have to do is.
    for the button webcontrol add the following:
    button.attribute.add("onClick","Javascript:return click();")
    This has to be put in the page load so that this function is available when
    the page is loaded.
    i think this is what you want.
    Anything else do reply.
    ARvind.
    <> wrote in message
    news:eYBjmJ3$...
    > Hi
    >
    > Has anyone any experience using client side validation with asp.net forms.
    >
    > Specifically I'd like to know...
    >
    > 1. How do you attach client side code web controls (a button), like a
    > JavaScript 'onclick' event for example?
    > 2. Any issues anyone has experienced using client side validation with
    > asp.net forms?
    >
    > Thanks in advance
    >
    > Simon Ames
    >
    >
    Arvind P Rangan, Mar 1, 2004
    #3
  4. Guest

    Jos Guest

    Krishnan wrote:
    > All validator controls run on the client side unless scripting in the
    > client browser is switched off. Hence using validator controls will
    > be equivalent to writing "Onclick" event code on the client side.


    Another condition is that the browser be IE.
    ASP.NET client side validation doesn't work in Netscape.

    --

    Jos
    Jos, Mar 1, 2004
    #4
  5. Guest

    Peter Blum Guest

    The button controls always use the client-side onclick event themselves for
    running the client-side validation. You cannot just use
    Button1.Atttributes.Add("onclick", "[your code]")
    Instead, set Button1.CausesValidation = false to prevent it from generating
    that code. Then add your code. If you want the client-side validation to
    continue, the script is available by calling
    Page.GetPostBackClientReference. For example:
    Button1.Atttributes.Add("onclick", "[your code]" +
    Page.GetPostBackClientReference(Button1, ""))

    There are many issues with using client-side validation. In fact, there are
    many issues with validation in general. I publish a replacement to
    Microsoft's validations because there are so many limitations. Use this link
    to see all the problems I found: http://www.peterblum.com/vam/valmain.aspx.
    Even if you don't want my product ("Professional Validation And More" -
    http://www.peterblum.com/vam/home.aspx), this list will help you plan your
    development efforts better.

    --- Peter Blum
    www.PeterBlum.com
    Email:
    Creator of "Professional Validation And More" at
    http://www.peterblum.com/vam/home.aspx

    <> wrote in message
    news:eYBjmJ3$...
    > Hi
    >
    > Has anyone any experience using client side validation with asp.net forms.
    >
    > Specifically I'd like to know...
    >
    > 1. How do you attach client side code web controls (a button), like a
    > JavaScript 'onclick' event for example?
    > 2. Any issues anyone has experienced using client side validation with
    > asp.net forms?
    >
    > Thanks in advance
    >
    > Simon Ames
    >
    >
    Peter Blum, Mar 1, 2004
    #5
    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,071
    Chad Z. Hower aka Kudzu
    Jan 30, 2004
  2. JezB
    Replies:
    3
    Views:
    510
  3. =?Utf-8?B?dmlkeWE=?=
    Replies:
    1
    Views:
    740
    Kevin Spencer
    Jun 2, 2005
  4. Boss302
    Replies:
    0
    Views:
    1,021
    Boss302
    Nov 21, 2006
  5. Bogdan
    Replies:
    2
    Views:
    637
    Bogdan
    Jun 9, 2008
Loading...

Share This Page