Can I change custom validators event?

Discussion in 'ASP .Net Web Controls' started by wikarna@gmail.com, Aug 3, 2007.

  1. Guest

    I have developed a custom validator for checkboxes and checkbox list
    required validation.

    The problem I am having is that I cannot figure out how to change the
    event that fires this validator. I want it to be the onclick, but
    instead it seems to do it on the onblur.

    Would I need to modify the Hookup scripts, or is there an easier way
    to do it?

    Any response would be greatly appreciated!

    Thanks
     
    , Aug 3, 2007
    #1
    1. Advertising

  2. Teemu Keiski Guest

    You need to attach it in the rendering of the CheckBoxList which in practise
    mostly means custom control derived from CheckBoxList. Basically you need
    PoistBackOptions class instance, passing it the reference to the CBL and
    setting PerformValidation and ValidationGroup properties respectively. Then
    get the script by passing PostBackOptions instance to
    Page.ClientScript.GetPostBackEventReference. After that you have the script
    which you'd need to attach to the onclick. You certainly could do that on
    the Page to avoid custom control but that means some "glue" code on every
    page, the things is used on.


    --
    Teemu Keiski
    AspInsider, ASP.NET MVP
    http://blogs.aspadvice.com/joteke
    http://teemukeiski.net

    <> wrote in message
    news:...
    >I have developed a custom validator for checkboxes and checkbox list
    > required validation.
    >
    > The problem I am having is that I cannot figure out how to change the
    > event that fires this validator. I want it to be the onclick, but
    > instead it seems to do it on the onblur.
    >
    > Would I need to modify the Hookup scripts, or is there an easier way
    > to do it?
    >
    > Any response would be greatly appreciated!
    >
    > Thanks
    >
     
    Teemu Keiski, Aug 5, 2007
    #2
    1. Advertising

  3. Guest

    On Aug 5, 2:15 am, "Teemu Keiski" <> wrote:
    > You need to attach it in the rendering of the CheckBoxList which in practise
    > mostly means custom control derived from CheckBoxList. Basically you need
    > PoistBackOptions class instance, passing it the reference to the CBL and
    > setting PerformValidation and ValidationGroup properties respectively. Then
    > get the script by passing PostBackOptions instance to
    > Page.ClientScript.GetPostBackEventReference. After that you have the script
    > which you'd need to attach to the onclick. You certainly could do that on
    > the Page to avoid custom control but that means some "glue" code on every
    > page, the things is used on.
    >
    > --
    > Teemu Keiski
    > AspInsider, ASP.NET MVPhttp://blogs.aspadvice.com/jotekehttp://teemukeiski.net
    >
    > <> wrote in message
    >
    > news:...
    >
    > >I have developed a customvalidatorfor checkboxes and checkbox list
    > > required validation.

    >
    > > The problem I am having is that I cannot figure out how to change the
    > >eventthat fires thisvalidator. I want it to be the onclick, but
    > > instead it seems to do it on the onblur.

    >
    > > Would I need to modify the Hookup scripts, or is there an easier way
    > > to do it?

    >
    > > Any response would be greatly appreciated!

    >
    > > Thanks


    Thanks Teemu,

    Do you have any examples of any of this?

    Jonas
     
    , Aug 11, 2007
    #3
  4. Teemu Keiski Guest

    I have some of the idea implemented into my sample how to cause a poostback
    on main poage from a popup

    http://aspadvice.com/blogs/joteke/archive/2005/06/15/2340.aspx

    It utilizes the idea by generating the script call to Emulate as if the
    Button would be clicked while the popup is closed. Difference to your
    situation is that you need to set the properties of PostBAckOptions I
    mentioned, in order to make it call validation functions at client-side


    --
    Teemu Keiski
    AspInsider, ASP.NET MVP
    http://blogs.aspadvice.com/joteke
    http://teemukeiski.net


    <> wrote in message
    news:...
    > On Aug 5, 2:15 am, "Teemu Keiski" <> wrote:
    >> You need to attach it in the rendering of the CheckBoxList which in
    >> practise
    >> mostly means custom control derived from CheckBoxList. Basically you need
    >> PoistBackOptions class instance, passing it the reference to the CBL and
    >> setting PerformValidation and ValidationGroup properties respectively.
    >> Then
    >> get the script by passing PostBackOptions instance to
    >> Page.ClientScript.GetPostBackEventReference. After that you have the
    >> script
    >> which you'd need to attach to the onclick. You certainly could do that on
    >> the Page to avoid custom control but that means some "glue" code on every
    >> page, the things is used on.
    >>
    >> --
    >> Teemu Keiski
    >> AspInsider, ASP.NET
    >> MVPhttp://blogs.aspadvice.com/jotekehttp://teemukeiski.net
    >>
    >> <> wrote in message
    >>
    >> news:...
    >>
    >> >I have developed a customvalidatorfor checkboxes and checkbox list
    >> > required validation.

    >>
    >> > The problem I am having is that I cannot figure out how to change the
    >> >eventthat fires thisvalidator. I want it to be the onclick, but
    >> > instead it seems to do it on the onblur.

    >>
    >> > Would I need to modify the Hookup scripts, or is there an easier way
    >> > to do it?

    >>
    >> > Any response would be greatly appreciated!

    >>
    >> > Thanks

    >
    > Thanks Teemu,
    >
    > Do you have any examples of any of this?
    >
    > Jonas
    >
     
    Teemu Keiski, Aug 13, 2007
    #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. Ratman
    Replies:
    0
    Views:
    665
    Ratman
    Sep 14, 2004
  2. Charith Jayasundara via .NET 247

    How to use custom validators for dynamically genrated textboxes

    Charith Jayasundara via .NET 247, Mar 23, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    421
    Brock Allen
    Mar 23, 2005
  3. =?Utf-8?B?UGF1bA==?=

    anyone good with custom validators?

    =?Utf-8?B?UGF1bA==?=, May 16, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    462
    =?Utf-8?B?UGF1bA==?=
    May 16, 2005
  4. =?Utf-8?B?SmFzb24=?=

    Why Custom Validators work in FoxFire

    =?Utf-8?B?SmFzb24=?=, Jun 29, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    421
    Alvin Bruney [MVP - ASP.NET]
    Jun 29, 2005
  5. =?Utf-8?B?SmFzb24=?=

    Why Custom Validators WON'T work in FoxFire?

    =?Utf-8?B?SmFzb24=?=, Jun 29, 2005, in forum: ASP .Net
    Replies:
    5
    Views:
    633
    Paul Glavich [MVP ASP.NET]
    Aug 4, 2005
Loading...

Share This Page