VALIDATION CONTROLS
AIM :
To demonstrate the use of Validation Controls used in ASP.NET
PROCEDURE :
Step 1:- Open visual studio-->File-->New-->Web Site--> Select ASP.NET Empty
Website Change Language to Visual Basic Press OK
Step 2: In Solution Explorer-->Add New Item -> Web form-->and drag and drop the
following controls:
4 Label boxes
5 Text Boxes
1 Button and
4 Required Field Validation controls
1 Compare Validator
1 Range Validator
Step 3:- Change the following properties which are given below for every control:-
1) RequiredFieldValidator:- Go property of this control and change:-
ControlToValidate --> Text Box, Which is to be validated.
Error Message --> Error Message to be shown in the screen.
Text --> * (mandatory field),if required
2) CompareValidator :- Change the appropriate properties :
Control To Compare-->Which control is to be compared.
ControlToValidate --> Text Box, Which you want to validate.
Error Message --> Which you want to show on the screen.
Text --> * (mandatory field),if required
3) RangeValidator :- Change the appropriate properties :
ControlToValidate --> Text Box, Which you want to validate.
Error Message --> Which you want to show on the screen.
Maximum Value:-Enter Maximum value limit
Minimum Value :- Enter Minimum value limit.
Text --> * (mandatory field), if required
Step 4:- Run the Application (press F5)-->and enter the required fields.
Step 5:- Click the SUBMIT button--> Fill the form and view the output in browser.
Validation.aspx
HTML Coding
<%@ Page Language="C#" AutoEventWireup="true"
CodeFile="Validation.aspx.cs" Inherits="Validation" %>
<!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> Validation Control </title>
<style type="text/css">
.style1
{
width: 70%;
}
.style3
{
width: 277px;
text-align:
right;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<center> Validation Control </center>
</div
<table align="center" class="style1">
<tr>
<td class="style3"> Name </td>
<td>
<asp:TextBox ID="txtn" runat="server"> </asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1"
runat="server" ControlToValidate="txtn" ErrorMessage="Enter the
Name" ForeColor="Red">
</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="style3"> Email_id </td>
<td>
<asp:TextBox ID="txtemail" runat="server"> </asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
ControlToValidate="txtemail" ErrorMessage="Enter Email_id"
ForeColor="Red">
</asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1"
runat="server" ControlToValidate="txtemail" ErrorMessage="Invalid Email_id"
ForeColor="#000099" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\
w+([-.]\w+)*">
</asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td class="style3"> Password </td>
<td>
<asp:TextBox ID="txtp1" runat="server" TextMode="Password"> </asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3"runat="server"
ControlToValidate="txtemail" ErrorMessage="password is empty"
ForeColor="Red">
</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="style3"> Comfirm Password </td>
<td>
<asp:TextBox ID="txtp2" runat="server" TextMode="Password"> </asp:TextBox>
<asp:CompareValidator ID="CompareValidator2" runat="server"
ControlToCompare="txtp1" ControlToValidate="txtp2" ErrorMessage="Invalid
password" ForeColor="Red">
</asp:CompareValidator>
</td>
</tr>
<tr>
<td class="style2"> </td>
<td> </td>
</tr>
<tr>
<td class="style2"> </td>
<td>
<asp:Button ID="Button1" runat="server" onclick="Button1_Click"
Text="Register" Width="128px"/>
</td>
</tr>
</table>
</form>
</body>
</html>
Csharp(C#) Coding
Validation.aspx.cs
using System;
using
System.Collections.Generic;
using System.Linq;
using System.Web;
using
System.Web.UI;
using System.Web.UI.WebControls;
public partial class Validation : System.Web.UI.Page
{
protected void Button1_Click(object sender, EventArgs e)
{
Response.Redirect(“Default2.Aspx”);
}
}
Output:
Result:
To design a Validation Control Program has been executed successfully.
AD ROTATOR CONTROL
Ad_Rotator.aspx
HTML Coding
<%@ Page Language="C#" AutoEventWireup="true"
CodeFile="Ad_Rotator.aspx.cs" Inherits="Ad_Rotator" %>
<!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> Ad Rotator Control </title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:AdRotator ID="AdRotator1" runat="server"
AdvertisementFile="~/Rotator.xml" />
</div>
</form>
</body>
</html>
Rotator.xml
<?xml version="1.0" encoding="utf-8" ?>
<Advertisements>
<Ad>
<ImageUrl> ~/Images/rose1.jpg </ImageUrl>
</
Ad>
<Ad> <ImageUrl> ~/Images/rose2.jpg </ImageUrl>
</
Ad>
</Advertisements>
Output:
Result:
To design a Ad Rotator Program has been executed Successfully.
STATE MANAGEMENT
State.aspx
HTML Coding
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="State.aspx.cs" Inherits="State"
%>
<!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> State Management </title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div><br><br><br>
<center><asp:Button ID="Button1" runat="server" Text="Hit Count"
Height="40px"Width="98px"/>
<asp:Label ID="Label1" runat="server" Text="Values"></asp:Label> <br><br>
</form>
</body>
</html>
Csharp(C#) Coding
State.aspx.cs
using System;
using
System.Collections.Generic;
using System.Linq;
using System.Web;
using
System.Web.UI;
using System.Web.UI.WebControls;
public partial class State : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack)
{
if (ViewState["count"] != null)
{
int ViewstateVal =
Convert.ToInt32(ViewState["count"]) + 1; Label1.Text
= ViewstateVal.ToString();
} ViewState["count"] = ViewstateVal.ToString();
else
{
} ViewState["count"] = "1";
}
}
}
Output:
Result:
To design a State Management Program has been executed Successfully.
VIEW STATE
ViewState.aspx
Html Coding
<%@ Page Language="C#" AutoEventWireup="true"
CodeFile="ViewState.aspx.cs" Inherits="ViewState" %>
<!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 id="Head1" runat="server">
<title> View State </title>
</head>
<body>
<form id="form1" runat="server">
<div>
<table>
<tr>
<td> ViewState Data <strong>: </strong>
<asp:TextBox ID="txtname" runat="server"> </asp:TextBox>
</td>
<td> <b>
<asp:Label ID="lblString" runat="server"/> </b>
</td>
</tr>
<tr>
<td>
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Display
Value" />
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
Csharp(C#) Coding
ViewState.aspx.cs
using System;
using
System.Data;
using
System.Web;
public partial class ViewState : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
ViewState["name"] =
txtname.Text; txtname.Text = "";
}
protected void Button1_Click(object sender, EventArgs e)
{
lblString.Text = ViewState["name"].ToString();
}
}
Output:
Result:
To design a View State Program has been executed Successfully.
SESSION STATE
SessionState.aspx
Html Coding
<%@ Page Language="C#" AutoEventWireup="true"
CodeFile="SessionState.aspx.cs" Inherits="SessionState" %>
<!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>
<title> Session State </title>
<style type="text/css">
.auto-style1
{
width: 100%;
}
.auto-style2
{
width: 105px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<table class="auto-style1">
<tr>
<td class="auto-style2"> Email </td>
<td>
<asp:TextBox ID="email" runat="server"> </asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2"> Password </td>
<td>
<asp:TextBox ID="password" runat="server"> </asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Button ID="login" runat="server" Text="Login"
OnClick="login_Click" style="text-align: center" Width="92px" />
</td>
</tr>
</table>
<br />
<asp:Label ID="Label1" runat="server"> Session </asp:Label>
<br />
<asp:Label ID="Label2" runat="server"> Email_id </asp:Label>
</form>
</body>
</html>
Csharp(C#) Coding
SessionState.aspx.cs
using System;
using
System.Collections.Generic;
using System.Linq;
using System.Web;
using
System.Web.UI;
using System.Web.UI.WebControls;
public partial class SessionState : System.Web.UI.Page
{
protected void login_Click(object sender, EventArgs e)
{
if (password.Text == "bca2020")
{
Session["email"] = email.Text;
Label1.Text = "This email is stored to the
session."; Label2.Text =
Session["email"].ToString();
}
}
}
Output:
Result:
To design a Session State Program has been executed Successfully.
GRID VIEW
GridView.aspx
HTML Coding
<%@ Page Language="C#" AutoEventWireup="true"
CodeFile="GridView.aspx.cs" Inherits="GridView" %>
<!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> GridView </title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:BoundField DataField = "Company_id" HeaderText = "Company_id "/>
<asp:BoundField DataField = "Company_name " HeaderText = "Company_id "/>
<asp:BoundField DataField = "Contact" HeaderText = "Contact"/>
<asp:BoundField DataField = "Email" HeaderText = "Email"/>
<asp:BoundField DataField = "Country" HeaderText = "Country "/>
</Columns>
</asp:GridView>
</form>
</body>
</html>
Csharp(C#) Coding
GridView.aspx.cs
using System;
using
System.Collections.Generic;
using System.Linq;
using System.Web;
using
System.Web.UI;
using
System.Web.UI.WebControls;
using System.Data;
using
System.Data.SqlClient;
using
System.Configuration;
public partial class GridView : System.Web.UI.Page
{
string conn = "Data Source=localhost;database=sample;Integrated Security=true";
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
bindGridview();
}
}
private void bindGridview()
{
SqlConnection con = new SqlConnection(conn);
SqlCommand cmd = new SqlCommand("Select_Employees",
con);
cmd.CommandType = CommandType.StoredProcedure;
SqlDataReader reader;
try
{
con.Open();
reader =
cmd.ExecuteReader();
GridView1.DataSource =
reader;
}
GridView1.DataBind();
reader.Close();
}
}
con.Close();
Output:
Result:
To design a Grid View Program has been executed Successfully.
SERVER SIDE CONTROL
ServerSide.aspx
HTML Coding
<%@ Page Language="C#" AutoEventWireup="true"
CodeFile="ServerSide.aspx.cs" Inherits="ServerSide" %>
<!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 id="Head1" runat="server">
<title> Server Side Controls </title>
<style type="text/css">
.style1
{
width: 156px;
}
.style2
{
width: 332px;
}
.style3
{
width: 156px;
text-align:
right;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<table style="width: 54%;">
<tr>
<td class="style3"> Name: </td>
<td class="style2">
<asp:TextBox ID="txtname" runat="server" style="width:230px">
</asp:TextBox>
</td>
</tr>
<tr>
<td class="style3"> Street: </td>
<td class="style2">
<asp:TextBox ID="txtstreet" runat="server" style="width:230px">
</asp:TextBox>
</td>
</tr>
<tr>
<td class="style3"> City: </td>
<td class="style2">
<asp:TextBox ID="txtcity" runat="server" style="width:230px">
</asp:TextBox>
</td>
</tr>
<tr>
<td class="style3"> State: </td>
<td class="style2">
<asp:TextBox ID="txtstate" runat="server" style="width:230px">
</asp:TextBox>
</td>
</tr>
<tr>
<td class="style3"> PIN Code: </td>
<td class="style2">
<asp:TextBox ID="txtpin" runat="server" style="width:230px">
</asp:TextBox>
</td>
</tr>
<tr>
<td class="style1"> </td>
<td ID="displayrow" runat ="server" class="style2"> </td>
</tr>
</table>
</div>
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Submit"/>
</form>
</body>
</html>
Csharp(C#) Coding
ServerSide.aspx.cs
using System;
using
System.Collections.Generic;
using System.Linq;
using System.Web;
using
System.Web.UI;
using System.Web.UI.WebControls;
public partial class ServerSide : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
string str = "";
str += txtname.Text +
"<br />"; str +=
txtstreet.Text + "<br />"; str
+= txtcity.Text + "<br />";
str += txtstate.Text + "<br
/>"; str += txtpin.Text +
"<br />";
displayrow.InnerHtml = str;
}
}
Output:
Result:
To design a ServerSide Control Program has been executed Successfully.
ASP.NET MASTER PAGE, THEMES AND SKINS
MasterPage.Master
HTML Coding
<%@ Master Language="C#" AutoEventWireup="true"
CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>
<!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 id="Head1" runat="server">
<title>
<asp:ContentPlaceHolder ID="title" runat="server"></asp:ContentPlaceHolder>
</title>
<link href="Styles/Main.css" rel="stylesheet" type="text/css" />
<asp:ContentPlaceHolder id="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<div class="wrapper">
<div class="menu">
<ul>
<li class="navigation_first_item"><a href="Page.aspx"> Home </a></li>
<li><a href="Category.aspx"> Category </a></li>
<li><a href="Contact.aspx"> Contact </a></li>
<li><a href="About.aspx"> About </a></li>
</ul>
</div>
<div class="clear"></div>
<div class="content">
<asp:ContentPlaceHolder id="ContentBody" runat="server"></asp:ContentPlaceHolder>
</div>
<div class="clear"></div>
<div class="footer">
<h2> jayakumarbca.blogspot.com </h2>
</div>
</div>
</form>
</body>
</html>
Page.aspx
HTML Coding
<%@ Page Title="" Language="C#"
MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
CodeFile="Page.aspx.cs" Inherits="Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="title" Runat="Server"> Home
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="head" Runat="Server"></asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentBody" Runat="Server"> This
is Home Page....
</asp:Content>
Category.aspx
HTML Coding
<%@ Page Title="" Language="C#"
MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
CodeFile="Category.aspx.cs" Inherits="_Default" %>
<asp:Content ID="Content1" ContentPlaceHolderID="title" Runat="Server"> Category
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="head" Runat="Server"></asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentBody"
Runat="Server"> This is Category Page..
</asp:Content>
Contact.aspx
HTML Coding
<%@ Page Title="" Language="C#"
MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
CodeFile="Contact.aspx.cs" Inherits="Contant" %>
<asp:Content ID="Content1" ContentPlaceHolderID="title" Runat="Server"> Contact
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="head" Runat="Server"></asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentBody"
Runat="Server">This is Contact Page..
</asp:Content>
About.aspx
HTML Coding
<%@ Page Title="" Language="C#"
MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
CodeFile="About.aspx.cs" Inherits="About" %>
<asp:Content ID="Content1" ContentPlaceHolderID="title" Runat="Server"> About
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="head" Runat="Server"></asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentBody" Runat="Server"> This
is About Page..
</asp:Content>
Output:
Result:
To design and creating a MasterPage Program has been executed successfully.
WORKING WITH FORM
Form.aspx
HTML Coding
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Form.aspx.cs"
Inherits="Form" %>
<!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>
<style type="text/css">
.auto-style1
{
width: 70%;
}
.auto-style2
{
width: 200px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<table class="auto-style1">
<tr>
<td class="auto-style2"> Email </td>
<td>
<asp:TextBox ID="email" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2"> Password </td>
<td>
<asp:TextBox ID="password" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Button ID="login" runat="server" Text="Login"
OnClick="login_Click" style="text-align: center" Width="92px" />
</td>
</tr>
</table>
<br />
<asp:Label ID="Label1" runat="server"> Stored </asp:Label>
<br />
</form>
</body>
</html>
Csharp(C#) Coding
Form.aspx.cs
using System;
using
System.Collections.Generic;
using System.Linq;
using System.Web;
using
System.Web.UI;
using System.Web.UI.WebControls;
public partial class Form : System.Web.UI.Page
{
protected void login_Click(object sender, EventArgs e)
{
if (password.Text == "bca2020")
{
Session["email"] = email.Text;
Label1.Text = " Registered
Successfully. ";
}
}
}
Output:
Result:
To design and creating a Working Form Program has been executed successfully.
WORKING WITH PAGE
Page.aspx
HTML CODING
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Page.aspx.cs" Inherits="Page"
%>
<!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> Working Page </title>
</head>
<body>
<form id="form1" runat="server">
<center><div>
<asp:Button ID="Button1" runat="server" Text="Click Here"
onclick="Button1_Click1" style="height: 26px" />
</div></center><br><br><br>
</form>
</body>
</html>
Csharp(C#) Coding
Page.aspx.cs
using System;
using
System.Collections.Generic;
using System.Linq;
using System.Web;
using
System.Web.UI;
using System.Web.UI.WebControls;
public partial class Page : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click1(object sender, EventArgs e)
{
Response.Write(" Welcome to WebPage ");
}
}
Output:
Result:
To design and creating a Working Page Program has been executed successfully.
ACCESS DATA SOURCES
Data Sources.aspx
HTML Coding
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Data
Source.aspx.cs" Inherits="Data_Source" %>
<!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 id="Head1"
runat="server">
<title> Data Sources </title>
</head>
<body>
<form id="form1" runat="server">
<div> </div>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:BoundField DataField = "Employee_id"HeaderText = "Employee_id"/>
<asp:BoundField DataField = "Employee_name " HeaderText = "Employee_name"/>
<asp:BoundField DataField = "Job" HeaderText = "Job"/>
<asp:BoundField DataField = "Salary" HeaderText = "Salary"/>
</Columns>
</asp:GridView>
</form>
</body>
</html>
Csharp(C#) Coding
data sources.aspx.cs
using System;
using
System.Collections.Generic;
using System.Linq;
using System.Web;
using
System.Web.UI;
using System.Web.UI.WebControls;
public partial class Data_Source : System.Web.UI.Page
{
string conn = "Data Source=localhost;database=sample;Integrated Security=true";
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
bindGridview();
}
}
private void bindGridview()
{
SqlConnection con = new SqlConnection(conn);
SqlCommand cmd = new SqlCommand("Select_Employees",
con); cmd.CommandType =
CommandType.StoredProcedure; SqlDataReader reader;
try
{
con.Open();
reader =
cmd.ExecuteReader();
GridView1.DataSource =
reader;
}
GridView1.DataBind();
reader.Close();
catch (Exception ex)
{
}
finally
{
con.Close();
}
}
}
Output:
Result:
To design and creating a Data Sources Program has been executed successfully.