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

What is viewstate?

6 Answers   Abacus, Microsoft, Sopra,


How do cookies work?

0 Answers  


I have a textbox , assign required field validator and i have two buttons 1) save 2) cancel , i want the validator run only when i click save button, don't validate cancel button , what to do?

7 Answers   eMids, Infotech, Integra, TCS, Wipro,


How do you relate an aspx page with its code behind Page?

2 Answers   Accenture,


What is Bundling and Minification in MVC?

0 Answers   HCL,






When during the page processing cycle is ViewState available?

1 Answers  


What is the difference between rest and restful?

0 Answers  


Asp.Net Source :- In my project i have gridview control - item template. Its have asp:button control. my requirement is while click this button i need to display some alert message. Could you please help me which gridview event i need to write source code? Please give me a quick response. Thanks

6 Answers  


what is wwf in asp.net?

3 Answers  


What is localization and Globalization?

3 Answers  


How to change the form layout in ASp.net 2.0 ?

1 Answers   Netsweeper,


What type of code (server or client) is found in a Code-Behind class?

3 Answers   Siebel Systems,


Categories