0% found this document useful (0 votes)
249 views6 pages

A) Create A Registration Form To Demonstrate Use of Various Validation Controls

The document describes two web form practical exercises: 1) A registration form with various validation controls to validate user input. 2) A web form using an AdRotator control to display multiple advertisements by pulling data from an XML file. Both forms utilize ASP.NET controls, labels, textboxes, buttons, validators, calendars and dropdown lists.

Uploaded by

sushil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
249 views6 pages

A) Create A Registration Form To Demonstrate Use of Various Validation Controls

The document describes two web form practical exercises: 1) A registration form with various validation controls to validate user input. 2) A web form using an AdRotator control to display multiple advertisements by pulling data from an XML file. Both forms utilize ASP.NET controls, labels, textboxes, buttons, validators, calendars and dropdown lists.

Uploaded by

sushil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 6

T.Y.B.Sc. (I.T.

) – Advanced Web Programming –Paper (III) [Your Roll No]

Practical No: [4]: Working with Form Controls

a) Create a Registration form to demonstrate use of various Validation controls.

GUI:-

Source Code: - Html Code

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Railway Reservation.aspx.cs"


Inherits="WebApplicationsDiv2.Railway_Reservation" %>

<!DOCTYPE html>

Page 1
T.Y.B.Sc. (I.T.) – Advanced Web Programming –Paper (III) [Your Roll No]

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>

<asp:Label ID="lbl1" runat="server" Text="Name of Passanger:-"></asp:Label>


<asp:TextBox ID="txtbx1" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="txtbx1" ErrorMessage="Please Enter Name"
ForeColor="Red"></asp:RequiredFieldValidator>
<br />
<br />
<asp:Label ID="lbl2" runat="server" Text="Address"></asp:Label>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp;&nbsp;&nbsp;&nbsp;
<asp:TextBox ID="txtbx2" runat="server" TextMode="MultiLine"></asp:TextBox>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Label ID="lbl11" runat="server" Text="Password"></asp:Label>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:TextBox ID="txtbx9" runat="server" TextMode="Password"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
ControlToValidate="txtbx9" ErrorMessage="Please Enter Password"
ForeColor="Red"></asp:RequiredFieldValidator>
<asp:CompareValidator ID="CompareValidator1" runat="server"
ControlToCompare="txtbx9" ControlToValidate="txtbx10" ErrorMessage="Password Do Not
Match" ForeColor="Red"></asp:CompareValidator>
<br />
<br />
<asp:Label ID="lbl3" runat="server" Text="Phone No."></asp:Label>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:TextBox ID="txtbx3" runat="server" MaxLength="10"
TextMode="Phone"></asp:TextBox>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Label ID="lbl12" runat="server" Text="Confirm Pass"></asp:Label>
&nbsp;<asp:TextBox ID="txtbx10" runat="server" TextMode="Password"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server"
ControlToValidate="txtbx10" ErrorMessage="Please enter Password"
ForeColor="Red"></asp:RequiredFieldValidator>
<br />
<br />
<asp:Label ID="lbl4" runat="server" Text="Age"></asp:Label>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:TextBox ID="txtbx4" runat="server"></asp:TextBox>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Label ID="lbl8" runat="server" Text="Email:-"></asp:Label>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:TextBox ID="txtbx7" runat="server" TextMode="Email"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server"
ControlToValidate="txtbx7" ErrorMessage="Please enter Email"
ForeColor="Red"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1"
runat="server" ControlToValidate="txtbx7" ErrorMessage="Invalid Email Id"
ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
ForeColor="Red"></asp:RegularExpressionValidator>
<br />
<br />
<asp:Label ID="lbl5" runat="server" Text="Date of Journey:-"></asp:Label>

Page 2
T.Y.B.Sc. (I.T.) – Advanced Web Programming –Paper (III) [Your Roll No]

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;
<asp:Label ID="lbl9" runat="server" Text="No. of Seats:-"></asp:Label>
<asp:TextBox ID="txtbx8" runat="server"></asp:TextBox>
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Calendar ID="Calendar2" runat="server" BackColor="White"
BorderColor="#3366CC" BorderWidth="1px" CellPadding="1" DayNameFormat="Shortest" Font-
Names="Verdana" Font-Size="8pt" ForeColor="#003399" Height="200px" Width="220px">
<DayHeaderStyle BackColor="#99CCCC" ForeColor="#336666" Height="1px" />
<NextPrevStyle Font-Size="8pt" ForeColor="#CCCCFF" />
<OtherMonthDayStyle ForeColor="#999999" />
<SelectedDayStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99"
/>
<SelectorStyle BackColor="#99CCCC" ForeColor="#336666" />
<TitleStyle BackColor="#003399" BorderColor="#3366CC" BorderWidth="1px"
Font-Bold="True" Font-Size="10pt" ForeColor="#CCCCFF" Height="25px" />
<TodayDayStyle BackColor="#99CCCC" ForeColor="White" />
<WeekendDayStyle BackColor="#CCCCFF" />
</asp:Calendar>
<br />
<asp:Label ID="lbl10" runat="server" Text="Journey Details:-"></asp:Label>
<br />
<br />
<asp:Label ID="lbl6" runat="server" Text="From:-"></asp:Label>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:DropDownList ID="DropDownList1" runat="server">
<asp:ListItem>mumbai</asp:ListItem>
<asp:ListItem>thane</asp:ListItem>
<asp:ListItem>kurla</asp:ListItem>
<asp:ListItem>dadar</asp:ListItem>
</asp:DropDownList>
<br />
<br />
<asp:Label ID="lbl7" runat="server" Text="To:-"></asp:Label>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:DropDownList ID="DropDownList2" runat="server">
<asp:ListItem>kudal</asp:ListItem>
<asp:ListItem>kankavli</asp:ListItem>
<asp:ListItem>sindhudurg</asp:ListItem>
<asp:ListItem>ratnagiri</asp:ListItem>
<asp:ListItem>chiplun</asp:ListItem>
<asp:ListItem>khed</asp:ListItem>
<asp:ListItem>panvel</asp:ListItem>
</asp:DropDownList>
<br />
<br />
<asp:Button ID="btn1" runat="server" Text="Submit" />

</div>
</form>
</body>
</html>

Source Code: - CS Code

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

Page 3
T.Y.B.Sc. (I.T.) – Advanced Web Programming –Paper (III) [Your Roll No]

using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebApplicationsDiv2
{
public partial class Railway_Reservation : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

protected void btn1_Click(object sender, EventArgs e)


{
}
}
}

Output:-

Page 4
T.Y.B.Sc. (I.T.) – Advanced Web Programming –Paper (III) [Your Roll No]

b) Create Web Form to demonstrate use of Adrotator Control.

Source Code: - Html Code

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AdRotatorControl.aspx.cs"


Inherits="WebApplicationsDiv2.AdRotatorControl" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>

<asp:AdRotator ID="AdRotator1" runat="server" DataSourceID="XmlDataSource1"


Height="300px" Width="300px" />
<asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="~/adds.xml"
OnTransforming="XmlDataSource1_Transforming"></asp:XmlDataSource>

</div>
</form>
</body>
</html>

Source Code: - CS Code

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebApplicationsDiv2
{
public partial class AdRotatorControl : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void XmlDataSource1_Transforming(object sender, EventArgs e)
{

}
}
}

Page 5
T.Y.B.Sc. (I.T.) – Advanced Web Programming –Paper (III) [Your Roll No]

Page 6

You might also like