Strange problem with validation

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

  1. Hello!

    My problem is that i have validation controls on my webform but they are not
    "fired"
    because there is no "onclick" event being made on the button that should
    "fire" off the
    validation controls. I have tried to add the onclick event by myself by
    adding:

    LoginBtn.Attributes.Add("onclick", "if (typeof(Page_ClientValidate) ==
    'function') Page_ClientValidate(); ")

    But that is not good enough because i need some server validation as well.
    The strangest
    is that I have two web applications, one that works perfectly and one that
    doesn't.

    Can anyone think of any reason why the onclick event should not be created?

    Hope for some help, I'm stuck.

    Regards,
    Marius
    Marius Traelnes, Mar 1, 2004
    #1
    1. Advertising

  2. Hi, Marius Traelnes,

    Check that all the needed attributes are set on the validation controls:

    runat="server"
    controltovalidate="someControlID"

    Hope this helps
    Martin
    "Marius Traelnes" <> wrote in message
    news:#OeFTqz$...
    > Hello!
    >
    > My problem is that i have validation controls on my webform but they are

    not
    > "fired"
    > because there is no "onclick" event being made on the button that should
    > "fire" off the
    > validation controls. I have tried to add the onclick event by myself by
    > adding:
    >
    > LoginBtn.Attributes.Add("onclick", "if (typeof(Page_ClientValidate) ==
    > 'function') Page_ClientValidate(); ")
    >
    > But that is not good enough because i need some server validation as well.
    > The strangest
    > is that I have two web applications, one that works perfectly and one that
    > doesn't.
    >
    > Can anyone think of any reason why the onclick event should not be

    created?
    >
    > Hope for some help, I'm stuck.
    >
    > Regards,
    > Marius
    >
    >
    Martin Dechev, Mar 1, 2004
    #2
    1. Advertising

  3. Marius,
    if you are creating onClick event its normally for the client side if u are
    adding it as you have mentioned.
    But you cannot fire both serve side and client side at a go.
    You need to decide which is more important and then you need to code it
    accordingly.
    If you want to check if Client side is running just run a simple javascript.
    Add a javascript whichsays 'hello' and then add the function name in your
    attribute.add("onclick","javascript:hello();")
    if this fires then client side onclick is working gr8.
    Arvind.


    "Marius Traelnes" <> wrote in message
    news:%23OeFTqz$...
    > Hello!
    >
    > My problem is that i have validation controls on my webform but they are

    not
    > "fired"
    > because there is no "onclick" event being made on the button that should
    > "fire" off the
    > validation controls. I have tried to add the onclick event by myself by
    > adding:
    >
    > LoginBtn.Attributes.Add("onclick", "if (typeof(Page_ClientValidate) ==
    > 'function') Page_ClientValidate(); ")
    >
    > But that is not good enough because i need some server validation as well.
    > The strangest
    > is that I have two web applications, one that works perfectly and one that
    > doesn't.
    >
    > Can anyone think of any reason why the onclick event should not be

    created?
    >
    > Hope for some help, I'm stuck.
    >
    > Regards,
    > Marius
    >
    >
    Arvind P Rangan, Mar 1, 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. =?Utf-8?B?T3NjYXJBcmc=?=

    strange problem with date validation

    =?Utf-8?B?T3NjYXJBcmc=?=, Oct 19, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    384
    =?Utf-8?B?T3NjYXJBcmc=?=
    Oct 19, 2005
  2. Arthur
    Replies:
    2
    Views:
    377
    Richard Tobin
    Feb 3, 2005
  3. Harvey Twyman
    Replies:
    8
    Views:
    543
    August Derleth
    Oct 25, 2003
  4. Tim_Mac
    Replies:
    7
    Views:
    6,115
    Steven Cheng[MSFT]
    Aug 24, 2006
  5. bnp
    Replies:
    4
    Views:
    282
Loading...

Share This Page