Required Field Validator In Asp.Net

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

The Simple validation control is the “Required Field Validator” control , 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 Required Field 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  required field validator for textbox . After this, drag label, textbox ,required field validator controls from toolbox you see in figure.


After drag controls from toolbox , now go to properties of required field validator. Here i given this control the error message “Student name can not be blank.” using its errormessage property. I also have set the  controlTo validate property of this control to Textbox1 as shown in figure..


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 required field 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.



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


Post a Comment

Search Engine Optimization by Master Google