Code not triggering

Discussion in 'ASP .Net' started by John, Oct 3, 2004.

  1. John

    John Guest

    Hi

    On my webform, in design mode when I double click on the button component,
    it creates a click sub for me. But when I add code to the click event and
    run the web form the code does not seem to be executed. I have verified this
    by setting break points. Why would clicking the button not execute the click
    sub in this case?

    Thanks

    Regards
     
    John, Oct 3, 2004
    #1
    1. Advertising

  2. John

    OYTUN ASKIN Guest

    Do you have some sort of a validator object on any of the fields? If so and
    your validator is triggered, then the code will not work.
    "John" <> wrote in message
    news:OwyDy$...
    > Hi
    >
    > On my webform, in design mode when I double click on the button component,
    > it creates a click sub for me. But when I add code to the click event and
    > run the web form the code does not seem to be executed. I have verified

    this
    > by setting break points. Why would clicking the button not execute the

    click
    > sub in this case?
    >
    > Thanks
    >
    > Regards
    >
    >
     
    OYTUN ASKIN, Oct 3, 2004
    #2
    1. Advertising

  3. John

    John Guest

    This is a required valuator. What should I do to validate the field and
    process the entries if the validation is fine?

    Thanks

    Regards

    "OYTUN ASKIN" <> wrote in message
    news:mtL7d.769$pw4.403@trnddc01...
    > Do you have some sort of a validator object on any of the fields? If so

    and
    > your validator is triggered, then the code will not work.
    > "John" <> wrote in message
    > news:OwyDy$...
    > > Hi
    > >
    > > On my webform, in design mode when I double click on the button

    component,
    > > it creates a click sub for me. But when I add code to the click event

    and
    > > run the web form the code does not seem to be executed. I have verified

    > this
    > > by setting break points. Why would clicking the button not execute the

    > click
    > > sub in this case?
    > >
    > > Thanks
    > >
    > > Regards
    > >
    > >

    >
    >
     
    John, Oct 3, 2004
    #3
  4. John

    Peter Blum Guest

    I'm in disagreement with Oytun's reply and wanted to offer my help.

    Validators do not block a button's Click event from running. The Click event
    is always fired if its correctly setup.

    Here's how validators work with buttons:
    1. When the CausesValidation property is true (which is the default), it
    internally calls Page.Validate() for you.
    2. In your Click event, it is your responsibility to check Page.IsValid
    before attempting to use the data.

    In my experience, here's what causes a Click event not to fire:
    1. It is not hooked up correctly.
    2. Client-side validators are setup. When you submit, they prevent
    submitting for various reasons and you never get a post back. Without a post
    back, no server side code runs, including your Click event.
    If you think that the page is valid but it does not post back, you may have
    a buggy version of ASP.NET's validation. There is a problematic release in
    the 1.1 series of releases. I haven't had this problem myself but have seen
    many users with it and they have either found a hot fix on
    msdn.microsoft.com or removed a hot fix. So it may be due to a particular
    hot fix.

    To test this, turn off client side validation by setting
    EnableClientScript=false on each validator. Now no client-side code will
    interfere with post back.

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

    "John" <> wrote in message
    news:...
    > This is a required valuator. What should I do to validate the field and
    > process the entries if the validation is fine?
    >
    > Thanks
    >
    > Regards
    >
    > "OYTUN ASKIN" <> wrote in message
    > news:mtL7d.769$pw4.403@trnddc01...
    >> Do you have some sort of a validator object on any of the fields? If so

    > and
    >> your validator is triggered, then the code will not work.
    >> "John" <> wrote in message
    >> news:OwyDy$...
    >> > Hi
    >> >
    >> > On my webform, in design mode when I double click on the button

    > component,
    >> > it creates a click sub for me. But when I add code to the click event

    > and
    >> > run the web form the code does not seem to be executed. I have verified

    >> this
    >> > by setting break points. Why would clicking the button not execute the

    >> click
    >> > sub in this case?
    >> >
    >> > Thanks
    >> >
    >> > Regards
    >> >
    >> >

    >>
    >>

    >
    >
     
    Peter Blum, Oct 4, 2004
    #4
    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. Eric B
    Replies:
    1
    Views:
    1,908
    Eric B
    Sep 3, 2003
  2. John Boy
    Replies:
    4
    Views:
    709
    Mr Newbie
    Nov 9, 2005
  3. =?Utf-8?B?RGFiYmxlcg==?=

    validator control not triggering in formview

    =?Utf-8?B?RGFiYmxlcg==?=, Apr 9, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    3,219
    =?Utf-8?B?RGFiYmxlcg==?=
    May 3, 2006
  4. Replies:
    4
    Views:
    469
  5. ButtonNovice

    Applet Buttons Not Triggering

    ButtonNovice, Jun 3, 2006, in forum: Java
    Replies:
    0
    Views:
    347
    ButtonNovice
    Jun 3, 2006
Loading...

Share This Page