Breaking News

Required Field Validator In Asp.Net

Know More : Microsoft ASP.Net  Microsoft VB.Net  Microsoft C#.Net  Microsoft Sliverlight  XMLMicrosoft WPF  Microsoft WCF Ajax Microsoft SQL Server

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 Microsoft 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.
ScreenShot086
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..



ScreenShot085 
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.
ScreenShot088 
Thanks.

Know More : Microsoft ASP.Net  Microsoft VB.Net  Microsoft C#.Net  Microsoft Sliverlight  XMLMicrosoft WPF  Microsoft WCF Ajax Microsoft SQL Server

No comments