Home > C# Code Comments > Validation – Its just too easy

Validation – Its just too easy


Yes, I know we have been using this stuff for years but its still a buzz to use instead of custom javascript.

<asp:CompareValidator id=”someID” ControlToValidate=”someControl”
ControlToCompare=”someControl” or ValueToCompare=”someValue”
Type=”Currency|DateTime|Double|Integer|String”
Operator=”DataTypeCheck|Equal|GreaterThan|GreaterThanEqual|LessThan|LessThanEqual|NotEqual”
Display=”Dynamic|None|Static”
ErrorMessage=””
runAt=”server” >
ErrorMessage (e.g. “*”)
</asp:CompareValidator>

<asp:RequiredFieldValidator id=”someID” ControlToValidate=”someField”
Display=”Dynamic|None|Static”
ErrorMessage=”some error message”
RunAt=”Sever”>
ErrorMessage (e.g. “*”)
</asp:RequiredFieldValidator>

<asp:RangeValidator id=”someID” ControlToValidate=”someControl”
MaximumControl=”someControl”
MinimumControl=”someControl”
MaximumValue=”someValue”
MinimumValue=”someValue”
Type=”Currency|DateTime|Double|Integer|String”
Display=”Dynamic|None|Static”
ErrorMessage=”some error message”
RunAt=”server” >
ErrorMessage (e.g. “*”)
</asp:RangeValidator>

<asp:RegularExpressionValidator id=”someID” ControlToValidate=”someControl”
ValidationExpression=”some expression”
ErrorMessage=”some error message”
Display=”Dynamic|None|Static” >
ErrorMessage
</asp:RegularExpressionValidator>

<asp:CustomValidator id=”someID” ControlToValidate=”someControl”
onServerValidation=”someFunctionThatReturnsABoolean”
ClientSideValidation=”someFunction”
ErrorMessage=”some error message”
Display=”Dynamic|None|Static” >
ErrorMessage (e.g. “*”)
</asp:CustomValidator>

<asp:ValidationSummary id=”someID”
Showsummary=”True|False”
DisplayMode=”BulletList|List|SingleParagraph”
HeaderText=”some text”
RunAt=”server” >
</asp:ValidationSummary>

Advertisements
Categories: C# Code Comments
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

%d bloggers like this: