Practical 6
Code
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs"
Inherits="practical6A.WebForm1" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 99%;
}
.auto-style2 {
width: 364px;
}
.auto-style3 {
width: 581px;
}
</style>
</head>
<body style="width: 592px">
<form id="form1" runat="server">
<table class="auto-style1">
<tr>
<td class="auto-style2">NAME :</td>
<td class="auto-style3">
<asp:TextBox ID="TextBox1" runat="server"
OnTextChanged="TextBox1_TextChanged" ></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2"> </td>
<td class="auto-style3"> </td>
</tr>
<tr>
<td class="auto-style2">ROLL NUMBER :</td>
<td class="auto-style3">
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2"> </td>
<td class="auto-style3"> </td>
</tr>
<tr>
<td class="auto-style2">CLASS:</td>
<td class="auto-style3">
<asp:RadioButton ID="RadioButton1" runat="server" GroupName="rb"
Text="FY" />
<asp:RadioButton ID="RadioButton2" runat="server" GroupName="rb"
Text="SY" />
<asp:RadioButton ID="RadioButton3" runat="server" GroupName="rb"
Text="TY" />
</td>
</tr>
<tr>
<td class="auto-style2"> </td>
<td class="auto-style3"> </td>
</tr>
<tr>
<td class="auto-style2">COURSE</td>
<td class="auto-style3">
<asp:DropDownList ID="DropDownList1" runat="server"
OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">
<asp:ListItem>SELECT</asp:ListItem>
<asp:ListItem Value="BSC IT">BSC IT</asp:ListItem>
<asp:ListItem>BAF</asp:ListItem>
<asp:ListItem>BMM</asp:ListItem>
<asp:ListItem>BMS</asp:ListItem>
<asp:ListItem>BA</asp:ListItem>
<asp:ListItem>BCA</asp:ListItem>
<asp:ListItem>BCOM</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td class="auto-style2"> </td>
<td class="auto-style3"> </td>
</tr>
<tr>
<td class="auto-style2"> </td>
<td class="auto-style3">
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click"
Text="Button" />
</td>
</tr>
</table>
<div>
<asp:Label ID="Label1" runat="server"></asp:Label>
<asp:Label ID="Label2" runat="server"></asp:Label>
<asp:Label ID="Label3" runat="server"></asp:Label>
</div>
</form>
</body>
</html>
Practical 6
1
2
Practical 7
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs"
Inherits="practical7_validationcontrols.WebForm1" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
</style>
</head>
<body>
<form id="form1" runat="server">
<table class="auto-style1">
<tr>
<td class="auto-style2">Name :</td>
<td>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1"
runat="server" ControlToValidate="TextBox1"
ErrorMessage="RequiredFieldValidator"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="auto-style2"> </td>
<td> </td>
</tr>
<tr>
<td class="auto-style2">Roll Number :</td>
<td>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<asp:CustomValidator ID="CustomValidator1" runat="server"
ControlToValidate="TextBox2" ErrorMessage="CustomValidator"></asp:CustomValidator>
</td>
</tr>
<tr>
<td class="auto-style2"> </td>
<td> </td>
</tr>
<tr>
<td class="auto-style2">Class :</td>
<td>
<asp:RadioButton ID="RadioButton1" runat="server" GroupName="grp"
Text="FY" />
<asp:RadioButton ID="RadioButton2" runat="server" GroupName="grp"
Text="SY" />
<asp:RadioButton ID="RadioButton3" runat="server" GroupName="grp"
Text="TY" />
</td>
</tr>
<tr>
<td class="auto-style2"> </td>
<td> </td>
</tr>
<tr>
<td class="auto-style2">Course : </td>
<td>
<asp:DropDownList ID="DropDownList1" runat="server">
<asp:ListItem>SELECT</asp:ListItem>
<asp:ListItem>BSC IT</asp:ListItem>
<asp:ListItem>BSC</asp:ListItem>
<asp:ListItem>BCOM</asp:ListItem>
<asp:ListItem>BAF</asp:ListItem>
<asp:ListItem>BA</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td class="auto-style2"> </td>
<td> </td>
</tr>
<tr>
<td class="auto-style2">Age :</td>
<td>
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
<asp:RangeValidator ID="RangeValidator1" runat="server"
ControlToValidate="TextBox3" ErrorMessage="RangeValidator" MaximumValue="30"
MinimumValue="18"></asp:RangeValidator>
</td>
</tr>
<tr>
<td class="auto-style2"> </td>
<td> </td>
</tr>
<tr>
<td class="auto-style5">Contact Number :</td>
<td class="auto-style6">
<asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator2"
runat="server" ControlToValidate="TextBox4" ErrorMessage="Must be 10 digit"
ValidationExpression="\d{10}"></asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td class="auto-style2"> </td>
<td> </td>
</tr>
<tr>
<td class="auto-style2">Email ID :</td>
<td>
<asp:TextBox ID="TextBox5" runat="server"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1"
runat="server" ControlToValidate="TextBox5" ErrorMessage="invalid email"
ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-
.]\w+)*"></asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td class="auto-style3"></td>
<td class="auto-style4"></td>
</tr>
<tr>
<td class="auto-style2">Password :</td>
<td>
<asp:TextBox ID="TextBox7" runat="server"
TextMode="Password"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3"
runat="server" ControlToValidate="TextBox6"
ErrorMessage="RequiredFieldValidator"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="auto-style2"> </td>
<td> </td>
</tr>
<tr>
<td class="auto-style2">RE-ENTER Password :</td>
<td>
<asp:TextBox ID="TextBox6" runat="server"
TextMode="Password"></asp:TextBox>
<asp:CompareValidator ID="CompareValidator1" runat="server"
ControlToCompare="TextBox6" ControlToValidate="TextBox7"
ErrorMessage="CompareValidator"></asp:CompareValidator>
</td>
</tr>
</table>
<div>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button"
/>
</div>
<asp:Label ID="Label1" runat="server"></asp:Label>
<asp:ValidationSummary ID="ValidationSummary1" runat="server"
ShowMessageBox="True" />
</form>
</body>
</html>
Practical 8
Aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace multilnie
{
public partial class bindtext : System.Web.UI.Page
{
public string textdata;
protected void Page_Load(object sender, EventArgs e)
{
protected void TextBox2_TextChanged(object sender, EventArgs e)
{
textdata = TextBox2.Text;
this.DataBind();
}
}
}
Aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="bindtext.aspx.cs"
Inherits="multilnie.bindtext" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<asp:TextBox ID="TextBox1" Text='<%# textdata %>' runat="server" Height="192px"
TextMode="MultiLine"></asp:TextBox>
<asp:TextBox ID="TextBox2" runat="server" AutoPostBack="True"
OnTextChanged="TextBox2_TextChanged"></asp:TextBox>
<div>
</div>
</form>
</body>
</html>