Many times we need to validate some control in repeater based on rules. Most of develoepr i have seen doing this validtion on server side as many of controls are dynamically generated hence we can not use custom validation client function easily.
I fact, I followed it step by step. I created a Repeater control and a label, textbox and the custoomvalidator inside it. I've user the ItemDataBound event to register the attributes on runtime, I've created the javascript function. Until this point everyting
is OK.
The problem I'm having is at the moment to execute the Javascript function. I'm not pretty sure in which moment it will be executed. I'm handling a Update button in my Asp.net page similar as you have in your article (the click button). But, how the javascritp
function should be executed?
Do I need to put some code in the button?
niravbhattsa...
Participant
810 Points
161 Posts
Custom Validator client side validation in Repeater
Sep 08, 2010 12:50 PM|LINK
Many times we need to validate some control in repeater based on rules. Most of develoepr i have seen doing this validtion on server side as many of controls are dynamically generated hence we can not use custom validation client function easily.
I have created an artile for client side custom validation at http://www.aspnetajaxtutorials.com/2010/09/customvalidator-registerexpandoattribut.html
JavaScript registerexpandoattribute customvalidator
Software Engineer
Visit my Blog: ASP.Net Ajax Tutorials
Please Mark as Answered If post is helpful.
Lesthad_mk
Member
96 Points
159 Posts
Re: Custom Validator client side validation in Repeater
Feb 28, 2012 12:13 AM|LINK
Hi Nariv
I'm facing exactly the same problem in a project I'm working on. I just found the article you wrote: http://www.aspnetajaxtutorials.com/2010/09/customvalidator-registerexpandoattribut.html
I fact, I followed it step by step. I created a Repeater control and a label, textbox and the custoomvalidator inside it. I've user the ItemDataBound event to register the attributes on runtime, I've created the javascript function. Until this point everyting is OK.
The problem I'm having is at the moment to execute the Javascript function. I'm not pretty sure in which moment it will be executed. I'm handling a Update button in my Asp.net page similar as you have in your article (the click button). But, how the javascritp function should be executed?
Do I need to put some code in the button?
I appareciate your help on this
Thanks in advance
registerexpandoattribute
niravbhattsa...
Participant
810 Points
161 Posts
Re: Custom Validator client side validation in Repeater
Apr 18, 2012 09:42 AM|LINK
You do not need to put any extra code with your button. Just make sure you have same validation group.
Alternatively you can check whether Page_ClientValidate() function call validate the control or not.
Software Engineer
Visit my Blog: ASP.Net Ajax Tutorials
Please Mark as Answered If post is helpful.