Range Validator In ASP.Net

Know More :  ASP.Net  VB.Net  C#.Net  Sliverlight  XML  WPF  WCF Ajax

You use  “Range Validator” control to check if the value of a data-entry control is in a specified range of values , Range validator test if the value of a data entry  control is inside a specified range of values.You use three main properties here- the ControlToValidate property contains the data entry control to validate,and the MinimumValue and MaximumValue value properties specify the minimum and maximum values of the valid range,the error message in the ErrorMessage  property which makes simply sure that the user have entered data into data-entry control. If the data has not changed from that value when validation  occurs, the control displays its error message.The Range Validator in the validation controls example makes sure that the user has entered a class rank in the top textbox.Let’s start in Visual Studio 2010 , Create a new website name  it  range validator for textbox . After this, drag button,label, textbox ,range validator controls from toolbox you see in figure.

ScreenShot091

After drag controls from toolbox , now go to properties of Range Validator. Here i given this control the error message “Student name should be 25 char(minimum)”. Using its errormessage property. I also have set the  controlTo validate property of this control to Textbox1 ,also set maximum value 250, minimum value 25 also select type  string as shown in figure..

ScreenShot092

Now press F5 or select debug from debug menu , a debug window will be open and select “Run without debugging” your web page will be open in default browser. If the user doesn’t entry any data into the textbox and then clicks the button ,which sends the page back to the server, the Range validator displays its error message and stop the page from being sent to the server as you see in figure.The user can enter text in the textbox  and try again ,all without a round trip to the server.Thanks.

ScreenShot088

Know More :  ASP.Net  VB.Net  C#.Net  Sliverlight  XML  WPF  WCF Ajax

0 comments:

Post a Comment

 
Search Engine Optimization by Master Google