Categories:
.NET (961)
C (387)
C++ (185)
CSS (84)
DBA (8)
General (31)
HTML (48)
Java (641)
JavaScript (220)
JSP (109)
JUnit (31)
MySQL (297)
Networking (10)
Oracle (562)
Perl (48)
Perl (9)
PHP (259)
PL/SQL (140)
RSS (51)
Software QA (28)
SQL Server (5)
Struts (20)
Unix (2)
Windows (3)
XHTML (199)
XML (59)
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, 4830👍, 0💬
Popular Posts:
Which bit wise operator is suitable for turning on a particular bit in a number? The bitwise OR oper...
How does one iterate through items and records in a specified block? One can use NEXT_FIELD to itera...
What will be printed as the result of the operation below: main() { int x=5; printf("%d,%d,%d\n",x,x. ..
When should the register modifier be used? Does it really help? The register modifier hints to the c...
Where are all .NET Collection classes located ? System.Collection namespace has all the collection c...