Use of Required Field validator
Use of Required Field validator in asp.net
In Asp .Net RequiredFieldValidator use to use to fill some value in given Textbox Means you can not left it Empty.In .Net Programming of web development it is impotent at some time that we have some retraction by which user(which use this web page) can not left blank this particular Textbox.For RequiredFieldValidator Example in asp.net website at the login web page we all wage Enter the Username and password,the developer do not want to processing data in back site or by Query by bank data. Because we know that if you are registers user the you must have your own username and password on this site.Continuous validation of load test suites. So in the web programming we want RequiredFieldValidator for this Regression we give code also. simple you create your asp.net page and copy this code and past on your page. |
|
Asp.net web page code here:<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Required Field validator</title> </head><body> <form id="form1" runat="server"> <asp:TextBox ID="TxtPassword" runat="server" ToolTip="Enter Password" ValidationGroup="v"></asp:TextBox> <asp:RequiredFieldValidator runat="server" id="reqName" controltovalidate="TxtPassword" errormessage="Enter Passwors !" ValidationGroup="v"/> <asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" ValidationGroup="v"/> </form></body> </html> |
|
Hear we take a asp.net web page with name "Default2.aspx" and make code in web programming for the required file validator. we take a Textbox with name "TxtPassword".And take a Required field validatore then Associate this validatore with TxtPassword TExtbox.if the uesr left this textbox Empaty the give "Enter Password !" Error Message. |
Related Post : |
Old Post : |