Skip to main content

Posts

Showing posts from February, 2013

ASP.NET Validation Server Controls

ASP.Net validation controls validate the user input data to ensure that useless, unauthenticated or contradictory data don’t get entered. ASP.NET validation controls provide an easy-to-use but powerful mechanism of ensuring that data is entered correctly on the forms. A Validation server control is used to validate the data of an input control. If the data does not pass validation, it will display an error message to the user.
Client-Side and or Server-Side Validation: ASP.NET Validation Controls provides two types of validations: ·Client-side validation: We can enable or disable the Client-side validation by setting a true/false value to the EnableClientScript property of the Validation Control. We don’t need to do anything special for Client-Side validation except setting the property EnableClientScript=true. By enabling Client-side validation we can reduce the round trips. ·Server-side validation: If you want to do validation with your server side code (i.e. in C#, VB.Net language etc…

ASP.Net RangeValidator Control

RangeValidator: The RangeValidator control is used to check that the user enters an input value that falls between two values.
·It is possible to check ranges within numbers, dates, and characters. ·The validation will not fail if the input control is empty. Use the RequiredFieldValidator control to make the field required. ·The validation will not fail if the input value cannot be converted to the data type specified. Use the CompareValidator control, with its Operator property set to ValidationCompareOperator.DataTypeCheck, to verify the data type of the input value.
RangeValidator additional properties(Check here for other default properties and sample):

Property Description MaximumValue Specifies the maximum value of the range MinimumValue Specifies the minimum value of the range Type Specifies the data type of the values to compare. The types are: ·Currency ·Date ·Double ·Integer ·String
  Control usage:

ASP.Net ValidationSummary Control

ValidationSummary: The ValidationSummary control does not perform any validation but shows a summary of all errors in the page. The summary displays the values of the ErrorMessage property of all validation controls that failed validation.
The error message displayed in this control is specified by the ErrorMessage property of each validation control. If the ErrorMessage property of the validation control is not set, no error message is displayed for that validation control.
ValidationSummary additional properties(Check here for other default properties and sample):
Property Description DisplayMode How to display the summary. Values are: ·BulletList ·List ·SingleParagraph ShowMessageBox A Boolean value that specifies whether the summary should be displayed in a message box or not ShowSummary A Boolean value that specifies whether the ValidationSummary control should be displayed or hidden HeaderText Used to display header text above the errors.
  Control usage:

<asp:ValidationSummary

ASP.Net RegularExpressionValidator Control

RegularExpressionValidator control: The RegularExpressionValidator control is used to ensure that an input value matches a specified pattern.
·The validation will not fail if the input control is empty. Use the RequiredFieldValidator control to make the field required. ·Both server- and client-side validation are performed unless the browser does not support client-side validation or the EnableClientScript property is set to false. ·You can validate email, URL or can specify your own regular expression to validate against input value.
RegularExpressionValidator additional Properties (Check here for other default properties and sample):

Property Description ValidationExpression Specifies the expression used to validate input control. The expression validation syntax is different on the client than on the server. JScript is used on the client. On the server, the language you have specified is used
  Control usage:

<asp:TextBoxrunat="server"ID="txtNumber"></asp:…