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

Answers were Sorted based on User's Feedback



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

Answer / sravanthi kilari

Insert Custom Validator Control and then write the custom
function. If Other Validation Controls did't meet our
requirement then we will go to Custom Validator Control.

Is This Answer Correct ?    4 Yes 1 No

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

Answer / 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

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

Answer / santosh bind

when using the complex validation like text should not contain the max 50 char

protected void cusCustom_ServerValidate(object sender, ServerValidateEventArgs e)
{
if(e.Value.Length == 10)
e.IsValid = true;
else
e.IsValid = false;
}

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More ASP.NET Interview Questions

Code for updating the database by entering the data into textboxes in aspx form?

2 Answers   TCS, Wipro,


Which object encapsulates state or data of a user?

0 Answers  


What are cookies in your browser?

0 Answers  


What is full trust in asp.net?

0 Answers  


when using windows API in .net then it is managed code or Unmanaged code?

2 Answers  






What does uri mean?

0 Answers  


7. Do you have reference list?

4 Answers   CMC, Hotel Jobs, Mannar Company, Qatar Petroleums, Swatz Oils,


How can you handle errors in Web API?

0 Answers  


What are the events that happen when a client requests an asp.net page from iis server?

0 Answers  


In order to get assembly info which namespace we should import?

0 Answers  


What is WebService ?

8 Answers   Tanla Solutions, Yahoo,


Types of session management in ASP.NET ?

2 Answers   Microsoft,


Categories