Professional Documents
Culture Documents
Practical 5
Working with Navigation, Beautification and Master Page.
Program-
Default.aspx-
<%@ 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>
<h1>List of Courses</h1>
<asp:Menu ID="Menu1" runat="server" DataSourceID="SiteMapDataSource1">
</asp:Menu>
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />
</div>
</form>
</body>
</html>
Default2.aspx-
<%@ 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></title>
</head>
<body>
<form id="form1" runat="server">
<div>
P a g e 1 | 11
T.Y.B.SC(I.T.)-ADVANCED WEB PROGRAMMING-PAPER(III)
IT-7239
2018-2019
Default3.aspx-
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default3.aspx.cs"
Inherits="Default3" %>
<!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:SiteMapPath ID="SiteMapPath1" runat="server">
</asp:SiteMapPath>
<h1>Welcome to BSc-CS WebPage</h1>
</div>
</form>
</body>
</html>
Default4.aspx-
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default4.aspx.cs"
Inherits="Default4" %>
<!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:SiteMapPath ID="SiteMapPath1" runat="server">
</asp:SiteMapPath>
<h1>Welcome to BSc WebPage</h1>
</div>
</form>
</body>
</html>
P a g e 2 | 11
T.Y.B.SC(I.T.)-ADVANCED WEB PROGRAMMING-PAPER(III)
IT-7239
2018-2019
Web.sitemap-
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="Default.aspx" title="COURSE" description="">
<siteMapNode url="Default2.aspx" title="BSc-IT" description="" />
<siteMapNode url="Default3.aspx" title="BSc-CS" description="" />
<siteMapNode url="Default4.aspx" title="BSc" description="" />
</siteMapNode>
</siteMap>
Output-
P a g e 3 | 11
T.Y.B.SC(I.T.)-ADVANCED WEB PROGRAMMING-PAPER(III)
IT-7239
2018-2019
Program-
MasterPage.master-
<%@ 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 runat="server">
<title></title>
<asp:ContentPlaceHolder id="head" runat="server">
</asp:ContentPlaceHolder>
<style type="text/css">
P a g e 4 | 11
T.Y.B.SC(I.T.)-ADVANCED WEB PROGRAMMING-PAPER(III)
IT-7239
2018-2019
.style1
{
width: 90px;
height: 50px;
text-align:center;
}
#header
{
text-align:center;
background-color:Lime;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<h1 id="header">Our official WebSite.</h1>
<table align="center">
<tr>
<td class="style1"><asp:HyperLink ID="HyperLink1" runat="server"
NavigateUrl="~/Default.aspx">First Page</asp:HyperLink></td>
<td class="style1"><asp:HyperLink ID="HyperLink2" runat="server"
NavigateUrl="~/Default2.aspx">Second Page</asp:HyperLink></td>
</tr>
</table>
<asp:ContentPlaceHolder id="ContentPlaceHolder1"
runat="server"></asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>
Default.aspx-
<%@ Page Title="" Theme="Theme1" Language="C#" MasterPageFile="~/MasterPage.master"
AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<style type="text/css">
.s1{font-weight:bolder;font-style:italic;text-align:center;background-color:Aqua;}
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<h1 class="s1">Welcome to 1st page of our WebSite</h1>
<asp:Button SkinID="BLUE" ID="Button1" runat="server" Text="Button" />
<asp:Button SkinID="ORANGE" ID="Button2" runat="server" Text="Button" />
</asp:Content>
Default2.aspx-
P a g e 5 | 11
T.Y.B.SC(I.T.)-ADVANCED WEB PROGRAMMING-PAPER(III)
IT-7239
2018-2019
SkinFile1.skin-
<asp:Button SkinID="RED" runat="server" Text="RED" BackColor="Red" BorderColor="Black"
/>
<asp:Button SkinID="YELLOW" runat="server" Text="YELLOW" BackColor="Yellow"
BorderColor="Black" />
<asp:Button SkinID="BLUE" runat="server" Text="BLUE" BackColor="#0066FF"
BorderColor="Black" />
<asp:Button SkinID="ORANGE" runat="server" Text="ORANGE" BackColor="#FF9900"
BorderColor="Black" />
Output-
P a g e 6 | 11
T.Y.B.SC(I.T.)-ADVANCED WEB PROGRAMMING-PAPER(III)
IT-7239
2018-2019
Program-
5c.aspx-
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="5c.aspx.cs" Inherits="_5c" %>
<!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 align="center">
Design-
5c.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 _5c : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
ViewState["fn"] = TextBox1.Text;
ViewState["ln"] = TextBox2.Text;
TextBox1.Text = TextBox2.Text = string.Empty;
}
protected void Button2_Click(object sender, EventArgs e)
{
if (ViewState["fn"] != null)
{
TextBox1.Text = ViewState["fn"].ToString();
}
if (ViewState["ln"] != null)
{
TextBox2.Text = ViewState["ln"].ToString();
}
}
protected void Button3_Click(object sender, EventArgs e)
P a g e 8 | 11
T.Y.B.SC(I.T.)-ADVANCED WEB PROGRAMMING-PAPER(III)
IT-7239
2018-2019
{
int counter;
if (ViewState["Counter"] == null)
{
counter = 1;
}
else
{
counter = (int)ViewState["Counter"] + 1;
}
ViewState["Counter"] = counter;
Label3.Text = "Counter :" + counter.ToString();
}
protected void Button4_Click(object sender, EventArgs e)
{
HttpCookie h = new HttpCookie("fn");
h.Value = TextBox1.Text;
Response.Cookies.Add(h);
Response.Redirect("CookiePage.aspx");
}
}
CookiePage.aspx-
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="CookiePage.aspx.cs"
Inherits="CookiePage" %>
<!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>
</div>
</form>
</body>
</html>
CookiePage.aspx.cs-
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
P a g e 9 | 11
T.Y.B.SC(I.T.)-ADVANCED WEB PROGRAMMING-PAPER(III)
IT-7239
2018-2019
using System.Web.UI.WebControls;
public partial class CookiePage : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Request.Cookies["fn"] != null)
{
Response.Write("Welcome " + Request.Cookies["fn"].Value);
}
}
}
Output-
P a g e 10 | 11
T.Y.B.SC(I.T.)-ADVANCED WEB PROGRAMMING-PAPER(III)
IT-7239
2018-2019
P a g e 11 | 11