How do you use a custom validator? When might you want to
use one?

Answer Posted / pallavi

Field: <asp:textbox id="textbox1" runat="server">
<asp:CustomValidator id="valCustom" runat="server"
ControlToValidate="textbox1"
ClientValidationFunction="ClientValidate"
OnServerValidate="ServerValidate"
ErrorMessage="*This box is not valid" dispaly="dynamic">*
</asp:CustomValidator>

ClientValidationFunction is usually a javascript funtion included in the html to the user. OnServerValidate is the function that is server-side to check for validation if client does not support client-side validation.

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Differentiate between a hyperlink control and a linkbutton control.

550


What are the uses of reflection?

575


What is data binding in asp net?

586


Can you explain the basic use of dataview?

622


What New Features comes with ASP.NET Web API 2.0?

541






How long should a session id be?

522


What's the use of response.output.write()?

758


What is the concept of view state in asp.net?

560


What is difference between asp.net and asp.net mvc? : Asp.Net MVC

483


Explain about ASP.NET?

630


Explain the difference between authentication and authorization.

592


What is asp net application object?

535


Explain how does asp page work?

574


Where do we store our connection string in asp.net application?

524


How many web config files can be created for an application?

448