0% found this document useful (0 votes)
24 views5 pages

Awp (4a & 4B)

Advance web programming practical Practical notes Tybsc it Lat year

Uploaded by

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

Awp (4a & 4B)

Advance web programming practical Practical notes Tybsc it Lat year

Uploaded by

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

Practical No: 4

Aim: Working with Forms Controls

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

Code:
Default.aspx Page:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"
Inherits="_Default" %>

<!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></title> </head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" runat="server" Text="Practical No. 4"
Font-Bold="True" Font-Italic="True" Font-Names="Century Schoolbook"
Font-Size="XX-Large" Font-Underline="True" ForeColor="Red"></asp:Label>
<br />
<br />
<asp:Label ID="Label2" runat="server" Text="a) Validation Control
Example"
Font-Bold="True" Font-Names="Times New Roman" Font-Size="X-Large"
ForeColor="Blue"></asp:Label>
<br />
<br />
<asp:Label ID="Label3" runat="server" Text="Name:- " Font-Size="Larger">
</asp:Label>
<br />
<asp:TextBox ID="TextBox1" runat="server" Font-Size="Large"
Width="240px"> </asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="TextBox1" ErrorMessage="Name Should Not Be Empty."
Font-Italic="True" ForeColor="Red"></asp:RequiredFieldValidator>
<br />
<br />
<asp:Label ID="Label4" runat="server" Text="Address:- " Font-
Size="Larger">
</asp:Label>
<br />
<asp:TextBox ID="TextBox2" runat="server" Font-Size="Large" Height="50px"
TextMode="MultiLine" Width="240px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
ControlToValidate="TextBox2" ErrorMessage="Address Should Not Be
Empty." Font-Italic="True" ForeColor="Red"></asp:RequiredFieldValidator>
<br />
<br />
<asp:Label ID="Label5" runat="server" Text="Age:-" Font-Size="Larger">
</asp:Label>
<br />
<asp:TextBox ID="TextBox3" runat="server" Font-Size="Large"
Width="240px"> </asp:TextBox>
<asp:RangeValidator ID="RangeValidator1" runat="server"
ControlToValidate="TextBox3" ErrorMessage="Age Should Be Greater Than
21" Font-Italic="True" ForeColor="Red" MaximumValue="50"
MinimumValue="20">
</asp:RangeValidator>
<br />
<br />
<asp:Label ID="Label6" runat="server" Text="Email ID:-" Font-
Size="Larger">
</asp:Label>
<br />
<asp:TextBox ID="TextBox4" runat="server" Font-Size="Large"
Width="240px"> </asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1"
runat="server" ControlToValidate="TextBox4" ErrorMessage="Please Enter
Valid Email ID." Font-Italic="True" ForeColor="Red"
ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*">
</asp:RegularExpressionValidator>
<br />
<br />
<asp:Label ID="Label7" runat="server" Text="Password:-" Font-
Size="Larger">
</asp:Label>
<br />
<asp:TextBox ID="TextBox5" runat="server" Font-Size="Large"
TextMode="Password" Width="240px"></asp:TextBox>
<br />
<br />
<asp:Label ID="Label8" runat="server" Text="Confirm Password:-"
Font-Size="Larger"></asp:Label>
<br />
<asp:TextBox ID="TextBox6" runat="server" Font-Size="Large"
TextMode="Password" Width="240px"></asp:TextBox>
<asp:CompareValidator ID="CompareValidator1" runat="server"
ControlToCompare="TextBox5" ControlToValidate="TextBox6"
ErrorMessage="Password Does Not Match." Font-Italic="True"
ForeColor="Red"></asp:CompareValidator>
<br />
<br />
<br />
<asp:Button ID="Button1" runat="server" Text="Register" Font-Bold="True"
Font-Names="Times New Roman" Font-Size="Large" />
</div>
</form> </body> </html>

Output:
B) Create Web Form to demonstrate use of Adrotator Control.

Code:
AdvertisementFile.xml Page:
<?xml version="1.0" encoding="utf-8" ?>
<Advertisements>
<Ad>
<ImageUrl>computer-science-education.jpg</ImageUrl>
<NavigateUrl>https://www.google.co.in</NavigateUrl>
<AlternateText>Computer Science 1</AlternateText>
<Impressions>5</Impressions>
<Keyword>Hello 1</Keyword>
</Ad>
<Ad>
<ImageUrl>image (2).png</ImageUrl>
<NavigateUrl>https://www.google.co.in</NavigateUrl>
<AlternateText>Computer Science 2</AlternateText>
<Impressions>5</Impressions>
<Keyword>Hello 2</Keyword>
</Ad>
<Ad>
<ImageUrl>image.png</ImageUrl>
<NavigateUrl>https://www.google.co.in</NavigateUrl>
<AlternateText>Computer Science 3</AlternateText>
<Impressions>5</Impressions>
<Keyword>Hello 3</Keyword>
</Ad>
</Advertisements>

Default.aspx Page:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"
Inherits="_Default" %>

<!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></title> </head>
<body>
<form id="form1" runat="server">
<div>
<asp:AdRotator ID="AdRotator1" runat="server"
AdvertisementFile="~/AdvertisementFile.xml" Height="300px" Width="500px" />
</div>
</form>
</body>
</html>
Output:

After refreshing page…

You might also like