Can I change custom validators event?

W

wikarna

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
 
T

Teemu Keiski

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.
 
W

wikarna

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.

Thanks Teemu,

Do you have any examples of any of this?

Jonas
 
T

Teemu Keiski

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top