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, 5063👍, 0💬
Popular Posts:
How To Use mysqlbinlog to View Binary Logs? - MySQL FAQs - Server Daemon mysqld Administration If yo...
How do we access attributes using “XmlReader”? Below snippets shows the way to access attributes. Fi...
How does ASP.NET maintain state in between subsequent request ? Refer caching chapter.
Can Sub Procedure/Function Be Called Recursively? - Oracle DBA FAQ - Creating Your Own PL/SQL Proced...
How does multi-threading take place on a computer with a single CPU? The operating system's task sch...