Wednesday, February 25, 2009

ASP.NET Validation Controls with SampleCode

1.RequiredFieldValidator - is using for checking empty data or checking an initial value.


ErrorMessage="Enter Password" ControlToValidate="txtPassword"
SetFocusOnError="True">?



2.RegularExpressionValidator - is using for checking the data based upon a regular expression.


ErrorMessage="Invalid mail address" ControlToValidate="txtMail"
SetFocusOnError="True"
ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*">?



3.RangeValidator - is using for checking whether the input is in a range as we specified.



ErrorMessage="Invalid data" ControlToValidate="txtPassword"
MaximumValue="100" MinimumValue="0" SetFocusOnError="True" Type="Double">?



4.CompareValidator - is using for comparing two controls.


ErrorMessage="Retype password" ControlToCompare="txtPassword"
ControlToValidate="txtRePassword">?

Labels:

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home