Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
You find that one of your validation is very complicated and does not fit in any of the validators, what will you do
You find that one of your validation is very complicated and does not fit in any of the validators, what will you do ?
✍: Guest
Best is to go for CustomValidators. Below is a sample code for a custom validator which checks that a textbox should not have zero value
<asp:CustomValidator id="CustomValidator1" runat="server" ErrorMessage="Number not divisible by Zero" ControlToValidate="txtNumber" OnServerValidate="ServerValidate" ClientValidationFunction="CheckZero" />
Input: <asp:TextBox id="txtNumber" runat="server" /> <script language="javascript"> <!-- function CheckZero(source, args) { int val = parseInt(args.Value, 10); if (value==0) { args.IsValid = false; } else { args.IsValid = true; } } // --> </script>
2007-10-24, 4875👍, 0💬
Popular Posts:
How do you locate the first X in a string txt? A) txt.find('X'); B) txt.locate('X'); C) txt.indexOf(...
How To Increment Dates by 1? - MySQL FAQs - Introduction to SQL Date and Time Handling If you have a...
What is COCOMO I, COCOMOII and COCOMOIII? In CD we have a complete free PDF tutorial of how to prepa...
How to set a HTML document's background color? document.bgcolor property can be set to any appropria...
How many types of validation controls are provided by ASP.NET ? There are six main types of validati...