0% found this document useful (0 votes)
1K views149 pages

Advanced Web Programming Guide

This document is a certificate certifying that Miss. Shaikh Mariyam Hisamuddin of Class TY.BSc.IT bearing Roll No 83 has successfully completed the practical work and assignment in the subject of "Advanced Web Programming" during the academic year 2021-2022 under the guidance of Prof. Ali Ahmad as a partial requirement for her Bachelor of Science in Information Technology degree from the University of Mumbai. The certificate is issued by Oriental Education Society’s SANPADA COLLEGE OF COMMERCE & TECHNOLOGY on 07/10/21.

Uploaded by

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

Advanced Web Programming Guide

This document is a certificate certifying that Miss. Shaikh Mariyam Hisamuddin of Class TY.BSc.IT bearing Roll No 83 has successfully completed the practical work and assignment in the subject of "Advanced Web Programming" during the academic year 2021-2022 under the guidance of Prof. Ali Ahmad as a partial requirement for her Bachelor of Science in Information Technology degree from the University of Mumbai. The certificate is issued by Oriental Education Society’s SANPADA COLLEGE OF COMMERCE & TECHNOLOGY on 07/10/21.

Uploaded by

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

ADVANCE WEB PROGRAMMING PRACTICAL

Oriental Education Society’s

SANPADA COLLEGE OF COMMERCE & TECHNOLOGY


SECTOR-2, PLOT-3/4/5, ADJACENT SANPADA RAILWAY STATION, SANPADA (W), NAVI
MUMBAI-400 705.
DEPARTMENT OF INFORMATION TECHNOLOGY

CERTIFICATE

This is to certify that Miss. Shaikh Mariyam Hisamuddin of Class TY.BSc.IT


bearing Roll No 83 of Semester V has successfully completed the
Assignment/Practical work in the subject of “Advanced Web Programming”
during the academic year 2021 - 2022 under the guidance of Prof. Ali Ahmad
being the partial requirement for the fulfillment of the curriculum of Degree of
Bachelor of Science in Information Technology, University of Mumbai.

Place:
Sanpada

Date: 07/10/21

____________________ _____________________
Sign of Subject In-charge Sign of External Examiner

__________________ _____________________
Sign of H.O.D Sign of Principal

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

INDEX
Sr.N Practicals Date Sign
o
1. Working with basic C# and ASP .NET
a. Create an application that obtains four int values from the user and 29/06/2021
displays the product.
b. Create an application to demonstrate string operations. 29/06/2021
c. Create an application that receives the (Student Id, Student Name, 29/06/2021
Course Name, Date of Birth) information from a set of students. The
application should also display the information of all the students
once the data entered.
d. Create an application to demonstrate following operations 29/06/2021
i. Generate Fibonacci series. ii. Test for prime numbers.
iii. Test for vowels. iv. Use of
foreach loop with arrays v. Reverse a number and find
sum of digits of a number.
2. Working with Object Oriented C# and ASP .NET
a. Create simple application to perform following operations 06/07/2021
i. Finding factorial Value ii.
Money Conversion iii. Quadratic Equation
iv. Temperature Conversion
b. Create simple application to demonstrate use of 06/07/2021
following concepts i. Function Overloading ii.
Inheritance (all types) iii. Constructor
overloading iv. Interfaces
c. Create simple application to demonstrate use of 06/07/2021
following concepts i. Using Delegates and
events ii. Exception handling
3. Working with Web Forms and Controls
a. Create a simple web page with various sever controls to demonstrate 13/07/2021
setting and use of their properties. (Example : AutoPostBack)
b. Demonstrate the use of Calendar control to perform following 13/07/2021
operations.
a) Display messages in a calendar control b) Display
vacation in a calendar control
c) Selected day in a calendar control using style d) Difference
between two calendar dates
c. Demonstrate the use of Treeview control perform following 13/07/2021
operations.
a) Treeview control and datalist b) Treeview
operations

4. Working with Form Controls


a. Create a Registration form to demonstrate use of various Validation 20/07/2021
controls.
b. Create Web Form to demonstrate use of Adrotator Control. 20/07/2021

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

c. Create Web Form to demonstrate use User Controls. 20/07/2021

5. Working with Navigation, Beautification and Master page.


a. Create Web Form to demonstrate use of Website Navigation controls 03/08/2021
and Site Map.
b. Create a web application to demonstrate use of Master Page with 03/08/2021
applying Styles and Themes for page beautification.
c. Create a web application to demonstrate various states of ASP.NET 03/08/2021
Pages.

6. Working with Database


a. Create a web application bind data in a multiline textbox by querying 10/08/2021
in another textbox.
b. Create a web application to display records by using database. 10/08/2021
c. Demonstrate the use of Datalist link control. 10/08/2021

7. Working with Database


a. Create a web application to display Databinding using dropdownlist 17/08/2021
control.
b. Create a web application for to display the phone no of an author 17/08/2021
using database.
c. Create a web application for inserting and deleting record from a 17/08/2021
database. (Using Execute-Non Query).

8. Working with data controls


a. Create a web application to demonstrate various uses and properties 06/09/2021
of SqlDataSource.
b. Create a web application to demonstrate data binding using 06/09/2021
DetailsView and FormView Control.
c. Create a web application to display Using Disconnected Data Access 06/09/2021
and Databinding using GridView.

9. Working with GridView control


a. Create a web application to demonstrate use of GridView control 13/09/2021
template and GridView hyperlink.
b. Create a web application to demonstrate use of GridView button 13/09/2021
column and GridView events.
c. Create a web application to demonstrate GridView paging and 13/09/2021
Creating own table format using GridView.

10. Working with AJAX and XML


a. Create a web application to demonstrate reading and writing 20/09/2021
operation with XML.
b. Create a web application to demonstrate Form Security and Windows 20/09/2021
Security with proper Authentication and Authorization properties.

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

c. Create a web application to demonstrate use of various Ajax controls. 20/09/2021

11. Programs to create and use DLL 27/09/2021

PRACTICAL 1: Working with basic C# and ASP .NET


PRACTICAL 1(A):

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

AIM: Create an application that obtains four int values from the user
and displays the product.
Design:

HTML CODE:
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="multiplicationprogram.aspx.cs"
Inherits="practical1a.multiplicationprogram" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 100%;
}
.auto-style2 {
width: 172px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<table class="auto-style1">
<tr>
<td class="auto-style2">Multiplication program</td>
<td>&nbsp;</td>
</tr>

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

<tr>
<td class="auto-style2">enter first number </td>
<td>
<asp:TextBox ID="TextBox1"
runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">enter second number</td>
<td>
<asp:TextBox ID="TextBox2"
runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">enter third number</td>
<td>
<asp:TextBox ID="TextBox3"
runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">enter forth number</td>
<td>
<asp:TextBox ID="TextBox4"
runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Button ID="Button1" runat="server"
OnClick="Button1_Click" Text="Submit" />
</td>
<td>&nbsp;</td>
</tr>
<tr>
<td colspan="2">
<asp:Label ID="Label1"
runat="server"></asp:Label>
</td>
</tr>
</table>
</form>
</body>
</html>

C# CODE:
product.aspx.cs:

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

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

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

protected void Button1_Click(object sender, EventArgs e)


{
int a = int.Parse(TextBox1.Text);
int b = int.Parse(TextBox2.Text);
int c = int.Parse(TextBox3.Text);
int d = int.Parse(TextBox4.Text);
int pro = a * b * c * d;
Label1.Text = string.Format("multiplication {0} * {1} *
{2} * {3} is:{4}", a, b, c, d, pro);

}
}
}

OUTPUT:

PRACTICAL 1(B)
AIM: Create an application to demonstrate string operations.
DESIGN:

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

HTML CODE:
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="WebForm1.aspx.cs" Inherits="practical1b.WebForm1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 100%;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<table class="auto-style1">
<tr>
<td>String Operation</td>
</tr>
<tr>
<td>Enter String&nbsp;

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

<asp:TextBox ID="TextBox1"
runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Button ID="Button1" runat="server"
OnClick="Button1_Click" Text="Submit" />
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label1"
runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label2"
runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label3"
runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label4"
runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label5"
runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label6"
runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

<asp:Label ID="Label7"
runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label8"
runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label9"
runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label10"
runat="server"></asp:Label>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>

C# CODE:

string.aspx.cs:

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

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

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

protected void Button1_Click(object sender, EventArgs e)


{
string s = TextBox1.Text;
Label1.Text = "String Length:" + s.Length;
Label2.Text = "Substring:" + s.Substring(4, 3);
Label3.Text = "Upper String:" + s.ToUpper();
Label4.Text = "Lower String:" + s.ToLower();
string rev = "";
for (int i = s.Length - 1; i >= 0; i--)
{
rev = rev + s[i];
}
Label5.Text = "Reverse String:" + rev.ToString();
Label6.Text = "Replace 's' by 't' in String :" +
s.Replace('s', 't');
Label7.Text = "Insert 'u' in String:" + s.Insert(3,
"u");
Label8.Text = "String Truncate:" + s.Trim();
Label9.Text = "Remove String:" + s.Remove(4);
Label10.Text = "Index of String:" + s.IndexOf('e');
}
}
}

OUTPUT:

PRACTICAL 1(C):

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

AIM: Create an application that receives the (Student Id, Student Name, Course
Name, Date of Birth) information from a set of students. The application should
also display the Information of all the students once the data entered.

DESIGN:

HTML CODE:
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="WebForm.aspx.cs" Inherits="practical1c.WebForm" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 100%;
}
.auto-style2 {
width: 151px;
}
.auto-style3 {
width: 151px;
height: 23px;
}

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

.auto-style4 {
height: 23px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<table class="auto-style1">
<tr>
<td class="auto-style2">Personal
Application</td>
<td>&nbsp;</td>
</tr>
<tr>
<td class="auto-style2">Student Id</td>
<td>
<asp:TextBox ID="TextBox1"
runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">Student Name</td>
<td>
<asp:TextBox ID="TextBox2"
runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">Course Name</td>
<td>
<asp:TextBox ID="TextBox3"
runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">Date of Birth</td>
<td>
<asp:Calendar ID="Calendar1"
runat="server"></asp:Calendar>
</td>
</tr>
<tr>
<td class="auto-style2">Mobile Number</td>
<td>
<asp:TextBox ID="TextBox4"
runat="server"></asp:TextBox>
</td>
</tr>

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

<tr>
<td class="auto-style3">
<asp:Button ID="Button1" runat="server"
OnClick="Button1_Click" Text="Show" />
</td>
<td class="auto-style4">
<asp:Button ID="Button2" runat="server"
OnClick="Button2_Click" Text="Reset" />
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label1"
runat="server"></asp:Label>
</td>
<td>&nbsp;</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label2"
runat="server"></asp:Label>
</td>
<td>&nbsp;</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label3"
runat="server"></asp:Label>
</td>
<td>&nbsp;</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label4"
runat="server"></asp:Label>
</td>
<td>&nbsp;</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label5"
runat="server"></asp:Label>
</td>
<td>&nbsp;</td>
</tr>
<tr>
<td class="auto-style2">&nbsp;</td>
<td>&nbsp;</td>
</tr>

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

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

C# CODE
Studinfo.aspx.cs:

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

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

protected void Button1_Click(object sender, EventArgs e)


{
Label1.Text = "Student Id :" + TextBox1.Text;
Label2.Text = "Student Name :" + TextBox2.Text;
Label3.Text = "Course Name :" + TextBox3.Text;
Label4.Text = "Date of Birth :" +
Calendar1.SelectedDate.ToLongDateString();
Label5.Text = "Mobile Number :" + TextBox4.Text;

protected void Button2_Click(object sender, EventArgs e)


{
Label1.Text = "";
Label2.Text = "";
Label3.Text = "";
Label4.Text = "";
Label5.Text = "";
TextBox1.Text = "";
TextBox2.Text = "";
TextBox3.Text = "";
Calendar1.SelectedDate.ToLongDateString();

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

TextBox4.Text = "";
}

}
}

OUTPUT:

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

PRACTICAL 1(D)

AIM: Create an application to demonstrate following operations

I. Generate Fibonacci series.


II. Test for prime numbers.
III. Test for vowels.
IV. Use of foreach loop with arrays v. Reverse a number and find sum
of digits of a number

DESIGN:

HTML CODE:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Web.aspx.cs"
Inherits="practical1d.Web" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 100%;
}
.auto-style2 {
width: 124px;
}
.auto-style3 {
width: 152px;
}
.auto-style4 {

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

width: 194px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<table class="auto-style1">
<tr>
<td class="auto-style2">&nbsp;</td>
<td class="auto-style3">&nbsp;</td>
<td class="auto-style4">&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td class="auto-style2">Enter Number</td>
<td class="auto-style3">
<asp:TextBox ID="TextBox1"
runat="server"></asp:TextBox>
</td>
<td class="auto-style4">
<asp:Button ID="Button1" runat="server"
OnClick="Button1_Click" Text="Fibonacci series" Width="190px" />
</td>
<td>
<asp:Label ID="Label1" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td class="auto-style2">Enter Number</td>
<td class="auto-style3">
<asp:TextBox ID="TextBox2"
runat="server"></asp:TextBox>
</td>
<td class="auto-style4">
<asp:Button ID="Button2" runat="server"
OnClick="Button2_Click" Text="Check Prime Number" Width="191px" />
</td>
<td>
<asp:Label ID="Label2" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td class="auto-style2">Enter Number</td>
<td class="auto-style3">
<asp:TextBox ID="TextBox3"
runat="server"></asp:TextBox>
</td>
<td class="auto-style4">
<asp:Button ID="Button3" runat="server"
OnClick="Button3_Click" Text="Reverse Number" Width="194px" />
</td>
<td>

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

<asp:Label ID="Label3" runat="server"></asp:Label>


</td>
</tr>
<tr>
<td class="auto-style2">Enter Number</td>
<td class="auto-style3">
<asp:TextBox ID="TextBox4"
runat="server"></asp:TextBox>
</td>
<td class="auto-style4">
<asp:Button ID="Button4" runat="server"
OnClick="Button4_Click" Text="Sum of digit of number" /
</td>
<td>
<asp:Label ID="Label4" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td class="auto-style2">Enter Character</td>
<td class="auto-style3">
<asp:TextBox ID="TextBox5"
runat="server"></asp:TextBox>
</td>
<td class="auto-style4">
<asp:Button ID="Button5" runat="server"
OnClick="Button5_Click" Text="Check Vowel or not" Width="196px" />
</td>
<td>
<asp:Label ID="Label5" runat="server"></asp:Label>
</td>
</tr>
</table>
</div>
<p>
<span style="color: rgb(0, 0, 0); font-family: &quot;Times New
Roman&quot;; font-size: medium; font-style: normal; font-variant-
ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-
spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-
transform: none; white-space: normal; widows: 2; word-spacing: 0px;
-webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-
decoration-style: initial; text-decoration-color: initial; display: inline
!important; float: none;">Reading array by using foreach loop:</span></p>
<p>
<asp:Label ID="Label6" runat="server"></asp:Label>
</p>
</form>
</body>
</html>

C# CODE:
using System;

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

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

namespace practical1d
{
public partial class Web : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Label6.Text = "";
string[] ColorName = new string[] { "Red", "Yellow", "Green", "Black",
"Pink" };
foreach (string ColorNames in ColorName)
{
Label6.Text = Label6.Text + " " + ColorNames.ToString();
}

protected void Button1_Click(object sender, EventArgs e)


{
int a = 0, b = 1, c, i, n;

Label1.Text = "\n" + a.ToString() + "\n" + "\n" + b.ToString(); n =


Convert.ToInt32(TextBox1.Text);
for (i = 2; i < n; i++)
{
c = a + b;
Label1.Text = "\n" + Label1.Text + "\n" + "\n" + c.ToString();
a = b;
b = c;

}
}

protected void Button2_Click(object sender, EventArgs e)


{
int n, a = 0;
n = Convert.ToInt32(TextBox2.Text);
for (int i = 1; i <= n; i++)
{
if (n % i == 0)
{
a++;
}
}
if (a == 2)
Label2.Text = "The given number is prime";
else
Label2.Text = "The given number is not prime";

protected void Button3_Click(object sender, EventArgs e)


{
long num, i, rev = 0, sum = 0; num = Convert.ToInt32(TextBox3.Text);
while (num > 0)
{

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

i = num % 10; rev = i + rev * 10; num = num / 10;


sum = i + sum;
}
Label3.Text = String.Format("Reverse number is: {0} ", rev.ToString());
Label4.Text = String.Format("And sum is: {0}", sum.ToString());

protected void Button4_Click(object sender, EventArgs e)


{

protected void Button5_Click(object sender, EventArgs e)


{
char c = Convert.ToChar(TextBox5.Text);
switch (c)
{
case 'a':
Label5.Text = "a is vowel";
break;
case 'A':
Label5.Text = "A is vowel";
break;
case 'e':
Label5.Text = "e is vowel";
break;
case 'E':
Label5.Text = "E is vowel";
break;
case 'i':
Label5.Text = "i is vowel";
break;
case 'I':
Label5.Text = "I is vowel";
break;
case 'o':
Label5.Text = "o is vowel";
break;
case 'O':
Label5.Text = "O is vowel";
break;
case 'u':
Label5.Text = "u is vowel";
break;
case 'U':
Label5.Text = "U is vowel";
break;
default:
Label5.Text = TextBox5.Text + " is not a vowel";
break;
}
}
}
}

OUTPUT:

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

PRACTICAL 2: Working with Object Oriented C# and ASP .NET

PRACTICAL 2(A)

AIM: Create simple application to perform following operations


i. Finding factorial Value
ii. Money Conversion
iii. Quadratic Equation
iv. Temperature Conversion

i. Finding factorial Value:

DESIGN:

HTML CODE:
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="WebForm1.aspx.cs" Inherits="practical2a_i.WebForm1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

<title></title>
<style type="text/css">
.auto-style1 {
width: 100%;
}
.auto-style2 {
width: 130px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<table class="auto-style1">
<tr>
<td class="auto-style2">Enter Number :</td>
<td>
<asp:TextBox ID="TextBox1"
runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Button ID="Button1" runat="server"
Height="26px" OnClick="Button1_Click" Text="Factorial" Width="94px"
/>
</td>
<td>&nbsp;</td>
</tr>
<tr>
<td colspan="2">
<asp:Label ID="Label1" runat="server"
Text="Label"></asp:Label>
<asp:Label ID="Label2" runat="server"
Text="Label"></asp:Label>
</td>
</tr>
</table>
</form>
</body>
</html>

C# CODE:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

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

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

protected void Button1_Click(object sender, EventArgs e)


{
int n = int.Parse(TextBox1.Text);
double fact = 1;
for (int i = 1; i <= n; i++)
{
fact = fact * i;
Label1.Text = "Result:";
Label2.Text = fact.ToString();
}
}
}
}

OUTPUT:

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

ii. Money Conversion :

DESIGN:

HTML CODE:
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="WebForm1.aspx.cs" Inherits="Practical2a_ii.WebForm1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 100%;
}
.auto-style2 {
width: 172px;
}
</style>
</head>
<body>

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

<form id="form1" runat="server">


<div>
<table class="auto-style1">
<tr>
<td class="auto-style2">Enter Amount in Rupees :
</td>
<td>
<asp:TextBox ID="TextBox1"
runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Button ID="Button1" runat="server"
OnClick="Button1_Click" Text="US Dollars" />
</td>
<td>
<asp:Label ID="Label1"
runat="server"></asp:Label>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Button ID="Button2" runat="server"
OnClick="Button2_Click" Text="Euros" />
</td>
<td>
<asp:Label ID="Label2"
runat="server"></asp:Label>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Button ID="Button3" runat="server"
OnClick="Button3_Click" Text="British Pounds" />
</td>
<td>
<asp:Label ID="Label3"
runat="server"></asp:Label>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Button ID="Button4" runat="server"
OnClick="Button4_Click" Text="Japanese Yen" />
</td>
<td>
<asp:Label ID="Label4"
runat="server"></asp:Label>

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

</td>
</tr>
</table>
</div>
</form>
</body>
</html>

C# CODE:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

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

protected void Button1_Click(object sender, EventArgs e)


{
curConv s = new curConv();
double r = Convert.ToDouble(TextBox1.Text);
double rate = s.Dolr(r);
Label1.Text = rate.ToString();

protected void Button2_Click(object sender, EventArgs e)


{
curConv s = new curConv();
double r = Convert.ToDouble(TextBox1.Text);
double rate = s.Pound(r);
Label2.Text = rate.ToString();
}

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

protected void Button3_Click(object sender, EventArgs e)


{
curConv s = new curConv();
double r = Convert.ToDouble(TextBox1.Text);
double rate = s.Euros(r);
Label3.Text = rate.ToString();
}

protected void Button4_Click(object sender, EventArgs e)


{
curConv s = new curConv();
double r = Convert.ToDouble(TextBox1.Text);
double rate = s.Yen(r);
Label4.Text = rate.ToString();
}
}
public class curConv
{
public double Dolr(double r)
{
r = r * 0.015;
return r;
}
public double Euros(double r)
{
r = r * 0.012;
return r;
}
public double Pound(double r)
{
r = r * 0.011;
return r;
}
public double Yen(double r)
{
r = r * 1.64;
return r;
}
}
}

OUTPUT:

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

iii. Quadratic Equation:

DESIGN:

HTML CODE:
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="WebForm1.aspx.cs" Inherits="practical2.WebForm1" %>

<!DOCTYPE html>

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 100%;
}
.auto-style2 {
width: 85px;
}
.auto-style3 {
width: 85px;
height: 19px;
}
.auto-style4 {
height: 19px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<table class="auto-style1">
<tr>
<td class="auto-style3">Enter a</td>
<td class="auto-style4">
<asp:TextBox ID="txtBoxa" runat="server"
OnTextChanged="Page_Load"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">Enter b</td>
<td>
<asp:TextBox ID="txtBoxb"
runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">Enter c</td>
<td>
<asp:TextBox ID="txtBoxc"
runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Button ID="Button1" runat="server"
OnClick="Button1_Click" Text="Result" />

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

</td>
<td>
<asp:Button ID="Button2" runat="server"
Text="Reset" />
</td>
</tr>
<tr>
<td colspan="2">
<asp:Label ID="Label3"
runat="server"></asp:Label>
</td>
</tr>
<tr>
<td colspan="2">&nbsp;<asp:Label ID="Label1"
runat="server"></asp:Label>
<asp:Label ID="Label2"
runat="server"></asp:Label>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>

C# CODE:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace practical2
{

public partial class WebForm1 : System.Web.UI.Page


{
public void demo()
{
double a, b, c, r1, r2, x;
double det;
a = int.Parse(txtBoxa.Text);
b = int.Parse(txtBoxb.Text);
c = int.Parse(txtBoxc.Text);
det = (b * b) - (4 * a * c);
if (det > 0)

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

{
x = Math.Sqrt(det);
r1 = (-b + x) / (2 * a);
r2 = (-b - x) / (2 * a);
Label3.Text = "There are two roots:";
Label1.Text = r1.ToString();
Label2.Text = r2.ToString();
}
else if (det == 0)
{
x = Math.Sqrt(det);
r1 = (-b + x) / (2 * a);
Label1.Text = "There is only one root:";
Label2.Text = r1.ToString();
}
else
{
Label1.Text = "There is no root!!!";
}
}
protected void Page_Load(object sender, EventArgs e)
{

protected void Button1_Click(object sender, EventArgs e)


{
demo();
}
}
}

OUTPUT:

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

iv. Temperature Conversion:

DESIGN:

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

HTML CODE:
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="WebForm1.aspx.cs" Inherits="practical2a.WebForm1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 100%;
}
.auto-style3 {
width: 535px;
}
.auto-style4 {
text-align: center;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<table class="auto-style1">
<tr>
<td class="auto-style4"
colspan="2">&nbsp;Temperature Conversion</td>
</tr>
<tr>
<td class="auto-style3">Enter Value Celsius :
<asp:TextBox ID="TextBox1"
runat="server"></asp:TextBox>
&nbsp;<asp:Button ID="Button1" runat="server" Height="26px"
OnClick="Button1_Click" Text="Celsius to Fahrenheit" Width="200px"
/>
</td>
<td>
<asp:Label ID="Label1" runat="server"
Text="Label℉"></asp:Label>
</td>
</tr>
<tr>
<td class="auto-style3">Enter Value Fahrenheit :
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
&nbsp;<asp:Button ID="Button2" runat="server" Height="27px"
OnClick="Button2_Click" Text="Fahrenheit to Celsius" Width="199px"
/>

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

</td>
<td>
<asp:Label ID="Label2" runat="server"
OnDataBinding="Button2_Click" Text="Lable℃"></asp:Label>
</td>
</tr>
</table>
</form>
</body>
</html>

C# CODE:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace practical2a
{
public partial class WebForm1 : System.Web.UI.Page
{
public class tempConv
{
public double ctof(double temp)
{
temp = 9.0 / 5.0 * temp + 32;
return temp;
}
public double ftoc(double temp)
{
temp = (temp - 32) * 5 / 9;
return temp;
}
}
protected void Page_Load(object sender, EventArgs e)
{

protected void Button1_Click(object sender, EventArgs e)


{
tempConv s = new tempConv();
double n = Convert.ToDouble(TextBox1.Text);
double x = s.ctof(n);
Label1.Text = x.ToString();

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

protected void Button2_Click(object sender, EventArgs e)


{
tempConv s = new tempConv();
double n = Convert.ToDouble(TextBox2.Text);
double x = s.ftoc(n);
Label2.Text = x.ToString();
}
}
}

OUTPUT:

PRACTICAL 2(B):

AIM: Create simple application to demonstrate use of following concepts :


i. Function Overloading
ii. Inheritance (all types)
iii. Constructor overloading
iv. Interfaces
i. Function Overloading:

DESIGN:

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

HTML CODE:
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="WebForm1.aspx.cs" Inherits="Practical2b_i.WebForm1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 100%;
}
.auto-style2 {
width: 279px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<table class="auto-style1">
<tr>
<td class="auto-style2">Function
Overloading</td>
<td>&nbsp;</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label1"
runat="server"></asp:Label>
</td>
<td>&nbsp;</td>
</tr>
<tr>
<td class="auto-style2">

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

<asp:Label ID="Label2"
runat="server"></asp:Label>
</td>
<td>&nbsp;</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label3"
runat="server"></asp:Label>
</td>
<td>&nbsp;</td>
</tr>
</table>
</div>
</form>
</body>
</html>

C# CODE:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Practical2b_i
{
public partial class WebForm1 : System.Web.UI.Page
{
public int add(int a)
{
return a + a;
}
public int add(int a, int b)
{
return a + b;
}
public int add(int a,int b,int c)
{
return a + b + c;
}
protected void Page_Load(object sender, EventArgs e)
{
int x, y, z;
x = add(2);
y = add(2, 3);

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

z = add(2, 3, 4);
Label1.Text = x.ToString();
Label2.Text = y.ToString();
Label3.Text = z.ToString();
}
}
}

OUTPUT:

ii. Inheritance (all types):


1. Single Inheritance:
DESIGN:

HTML CODE:
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="SingleInheritance.aspx.cs"
Inherits="Practical2b_ii_1.SingleInheritance" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

<title></title>
<style type="text/css">
.auto-style1 {
width: 100%;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<table class="auto-style1">
<tr>
<td>Enter Number :&nbsp;
<asp:TextBox ID="TextBox1" runat="server"
Height="21px" Width="195px"></asp:TextBox>
&nbsp;<asp:Button ID="Button1" runat="server"
OnClick="Button1_Click" Text="Result" />
</td>
</tr>
<tr>
<td>Square of a number : <asp:Label ID="Label1"
runat="server"></asp:Label>
<br />
Cube of a number :&nbsp;
<asp:Label ID="Label2"
runat="server"></asp:Label>
&nbsp;&nbsp;</td>
</tr>
</table>
</form>
</body>
</html>

C# CODE:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

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

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

protected void Button1_Click(object sender, EventArgs e)


{
B s = new B();
int n = int.Parse(TextBox1.Text);
int x = s.sqr(n);
int y = s.cub(n);
Label1.Text = x.ToString();
Label2.Text = y.ToString();
}
}
public class A
{
public int sqr(int Val1)
{
return Val1 * Val1;
}
}
public class B:A
{
public int cub(int Val1)
{
int v1 = sqr(Val1);
return v1 * Val1;

}
}
}

OUTPUT:

2. Multilevel Inheritance:
DESIGN:

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

HTML CODE:
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="Multilevel_Inheritance.aspx.cs"
Inherits="practical2b_ii_2.Multilevel_Inheritance" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 100%;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<table class="auto-style1">
<tr>
<td>Enter Number :
<asp:TextBox ID="TextBox1" runat="server"
Height="21px" Width="174px"></asp:TextBox>
&nbsp;<asp:Button ID="Button1" runat="server"
OnClick="Button1_Click" Text="Result" />
</td>
</tr>
<tr>
<td>Number is power of 2 : <asp:Label
ID="Label1" runat="server"></asp:Label>
<br />
Number is power of 3 :
<asp:Label ID="Label2"
runat="server"></asp:Label>
<br />

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

Number is power of 4 : <asp:Label


ID="Label3" runat="server"></asp:Label>
</td>
</tr>
</table>
&nbsp;</div>
</form>
</body>
</html>

C# CODE:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

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

protected void Button1_Click(object sender, EventArgs e)


{
C s = new C();
int n = int.Parse(TextBox1.Text);
int x = s.pow2(n);
int y = s.pow3(n);
int z = s.pow4(n);
Label1.Text = x.ToString();
Label2.Text = y.ToString();
Label3.Text = z.ToString();

}
}
public class A
{
public int pow2(int Val1)
{
return Val1 * Val1;
}
}
public class B : A

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

{
public int pow3(int Val1)
{
int v1 = pow2(Val1);
return v1 * Val1;
}
}
public class C:B
{
public int pow4(int Val1)
{
int v1 = pow3(Val1);
return v1 * Val1;
}
}
}

OUTPUT:

3. Hierarchical Inheritance:

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

DESIGN:

HTML CODE:
<%@ Page Language="C#"
AutoEventWireup="true"
CodeBehind="Hierarchical_Inheri
tance.aspx.cs"
Inherits="Practical2b_ii_3.Hier
archical_Inheritance" %>

<!DOCTYPE html>

<html
xmlns="http://www.w3.org/1999/x
html">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 100%;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<table class="auto-style1">
<tr>
<td>Enter a :&nbsp;
<asp:TextBox ID="TextBox1"
runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>Enter b :&nbsp;
<asp:TextBox ID="TextBox2"
runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Button ID="Button1" runat="server"
OnClick="Button1_Click" Text="Result" />
</td>
</tr>
<tr>

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

<td>a+b=&nbsp; <asp:Label ID="Label1"


runat="server"></asp:Label>
<br />
a-b=&nbsp;
<asp:Label ID="Label2"
runat="server"></asp:Label>
</td>
</tr>
</table>
<div>
&nbsp;</div>
</form>
</body>
</html>

C# CODE:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Practical2b_ii_3
{
public class A
{
public int a;
public int b;
}
public class B:A
{
public int add(int Val1, int Val2)
{
a = Val1;
b = Val2;
return a + b;
}
}
public class C:A
{
public int sub(int Val1, int Val2)
{
a = Val1;
b = Val2;
return a - b;
}
}

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

public partial class Hierarchical_Inheritance :


System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

protected void Button1_Click(object sender, EventArgs e)


{
B s1 = new B();
C s2 = new C();
int m = int.Parse(TextBox1.Text);
int n = int.Parse(TextBox2.Text);
int x = s1.add(m, n);
int y = s2.sub(m, n);
Label1.Text = x.ToString();
Label2.Text = y.ToString();
}
}
}
OUTPUT:

iii. Constructor Overloading:

DESIGN:

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

HTML CODE:
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="WebForm1.aspx.cs" Inherits="practical2b_iii.WebForm1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 100%;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<table class="auto-style1">
<tr>
<td>Constructor Overloading :</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>
<asp:Label ID="Label1"
runat="server"></asp:Label>
</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>
<asp:Label ID="Label2"
runat="server"></asp:Label>
</td>
<td>&nbsp;</td>

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

</tr>
<tr>
<td>
<asp:Label ID="Label3"
runat="server"></asp:Label>
</td>
<td>&nbsp;</td>
</tr>
</table>
</div>
</form>
</body>
</html>

C# CODE:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace practical2b_iii
{

public partial class WebForm1 : System.Web.UI.Page


{
protected void Page_Load(object sender, EventArgs e)
{
add obj1 = new add(3);
add obj2 = new add(3, 4);
add obj3 = new add(3, 4, 5);
Label1.Text = obj1.r.ToString();
Label2.Text = obj2.r.ToString();
Label3.Text = obj3.r.ToString();
}
}
public class add
{
public int r;
public add(int a)
{
r = a + a;
}
public add(int a,int b)
{
r = a + b;
}

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

public add(int a,int b,int c)


{
r = a + b + c;
}
}
}

OUTPUT:

iv. Interfaces:
DESIGN:

HTML CODE:
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="WebForm1.aspx.cs" Inherits="practical2iv.WebForm1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 100%;
}
</style>

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

</head>
<body>
<form id="form1" runat="server">
<div>
<table class="auto-style1">
<tr>
<td>Area of a Circle and Rectangle using
Interface</td>
</tr>
<tr>
<td>Area of
Circle :&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Label ID="Label1"
runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>Area of Rectangle:&nbsp;&nbsp; <asp:Label
ID="Label2" runat="server"></asp:Label>
</td>
</tr>
</table>
</div>
</form>
<p>
&nbsp;</p>
</body>
</html>

C# CODE:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace practical2iv
{
interface Area
{
double show(double s, double t);
}
class Rect : Area
{
public double show(double s, double t)
{

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

return s * t;
}
}
class Circle : Area
{
public double show(double s, double t)
{
return (3.14 * s * s);
}
}
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Rect r1 = new Rect();
double x = r1.show(3, 4);
Circle c1 = new Circle();
double y = c1.show(3, 4);
Label1.Text = x.ToString();
Label2.Text = y.ToString();

}
}
}

OUTPUT:

PRACTICAL 2(C):

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

AIM: Create simple application to demonstrate use of


following concepts
i. Using Delegates and events
ii. Exception handling

i. Using Delegates and events:


DESIGN:

HTML CODE:
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="WebForm1.aspx.cs" Inherits="Practical2Ci.WebForm1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 100%;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<table class="auto-style1">
<tr>
<td>
<asp:Label ID="Label1"
runat="server"></asp:Label>
</td>
</tr>

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

<tr>
<td>
<asp:Label ID="Label2"
runat="server"></asp:Label>
</td>
</tr>
</table>
</form>
</body>
</html>

C# CODE:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Practical2Ci
{
public partial class WebForm1 : System.Web.UI.Page
{
public delegate string dele();
public static string display1()
{
string s1 = "Shaikh Mariyam";
return s1;
}
public static string display2()
{
string s2 = "Mariyam Hisam Shaikh";
return s2;
}
protected void Page_Load(object sender, EventArgs e)
{
dele d1 = new dele(display1);
d1();
dele d2 = new dele(display2);
d2();
Label1.Text = d1();
Label2.Text = d2();

}
}
}

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

OUTPUT:

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

ii. Exception handling :


DESIGN:

HTML CODE:
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="WebForm1.aspx.cs" Inherits="Practical2Cii.WebForm1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 100%;
}
.auto-style5 {
width: 1666px;
}
.auto-style6 {
width: 92%;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<table class="auto-style1">
<tr>
<td colspan="2">Division of Two Numbers</td>
</tr>
<tr>

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

<td class="auto-style5">Num1 :
<br />
</td>
<td class="auto-style6">
<asp:TextBox ID="TextBox1"
runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style5">
<asp:Button ID="Button1" runat="server"
Height="25px" OnClick="Button1_Click" Text="Result" Width="79px" />
<br />
</td>
<td class="auto-style6">&nbsp;</td>
</tr>
<tr>
<td class="auto-style5">
<asp:Label ID="Label1"
runat="server"></asp:Label>
<br />
</td>
<td class="auto-style6">&nbsp;</td>
</tr>
</table>
</form>
</body>
</html>

C# CODE:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

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

protected void Button1_Click(object sender, EventArgs e)

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

{
try
{
int a = int.Parse(TextBox1.Text);
int[] b = { 12, 23, 33 };
int resultVal;
resultVal = (b[3] / a);
Label1.Text="The result is:" + resultVal.ToString();
}
catch(System.DivideByZeroException ex)
{
Label1.Text = ex.ToString();
}
catch(System.IndexOutOfRangeException ex)
{
Label1.Text = ex.ToString();
}
}
}
}

OUTPUT:

PRACTICAL 3: Working with Web Forms and Controls

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

PRACTICAL 3(A):

AIM: Create a simple web page with various sever controls to demonstrate
setting and use of their properties. (Example : AutoPostBack)

DESIGN:

HTML CODE:
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="WebForm1.aspx.cs" Inherits="Practical3a.WebForm1" %>

<!DOCTYPE html>

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

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

<p>Email Id: <asp:TextBox ID="TextBox2"


runat="server"></asp:TextBox></p>
<p>Course: <asp:TextBox ID="TextBox3"
runat="server"></asp:TextBox></p>
<p>
Gender:
<asp:RadioButton ID="RadioButton1" runat="server"
Text="Male" />
<asp:RadioButton ID="RadioButton2" runat="server"
Text="Female" />
</p>
<p>
Sports:
<asp:CheckBox ID="CheckBox1" runat="server"
Text="Cricket" />
<asp:CheckBox ID="CheckBox2" runat="server"
Text="Chess" />
<asp:CheckBox ID="CheckBox3" runat="server"
Text="Badminton" />
<asp:CheckBox ID="CheckBox4" runat="server"
Text="BasketBall" />
</p>
<p>
<asp:Button ID="Button1" runat="server"
OnClick="Button1_Click" style="height: 26px" Text="Submit" />
</p>
<p>
<asp:Label ID="Label1" runat="server"></asp:Label>
</p>
<p>
<asp:Label ID="Label2" runat="server"></asp:Label>
</p>
<p>
<asp:Label ID="Label3" runat="server"></asp:Label>
</p>
<p>
<asp:Label ID="Label4" runat="server"></asp:Label>
</p>
<p>
<asp:Label ID="Label5" runat="server"></asp:Label>
</p>
</div>
</form>
</body>
</html>

C# CODE:

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

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

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

protected void Button1_Click(object sender, EventArgs e)


{
string name = TextBox1.Text;
string email = TextBox2.Text;
string course = TextBox3.Text;

string gender = "";


if (RadioButton1.Checked)
gender = RadioButton1.Text;
else
gender = RadioButton2.Text;

string sports = "";


if (CheckBox1.Checked)
sports = CheckBox1.Text + " ";
if (CheckBox2.Checked)
sports = CheckBox2.Text + " ";
if (CheckBox3.Checked)
sports = CheckBox3.Text + " ";
if (CheckBox4.Checked)
sports = CheckBox4.Text + " ";

Label1.Text = "Name: " + name;


Label2.Text = "Email ID: " + email;
Label3.Text = "Course: " + course;
Label4.Text = "Gender: " + gender;
Label5.Text = "Sports: " + sports;

}
}
}

OUTPUT:

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

PRACTICAL 3(B):

AIM: Demonstrate the use of Calendar control to perform following operations.

i.Display messages in a calendar control


ii.Display vacation in a calendar control
iii.Selected day in a calendar control using style
iv. Difference between two calendar dates
DESIGN:

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

HTML CODE:

<%@ Page Language="C#" AutoEventWireup="true"


CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication4.WebForm1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form2" runat="server">
<div>
<asp:Calendar ID="Calendar1" runat="server"
BackColor="White" BorderColor="Black" BorderStyle="Solid"
CellSpacing="1" Font-Names="Verdana" Font-Size="9pt"
ForeColor="Black" Height="250px" NextPrevFormat="ShortMonth"
OnDayRender="Calendar1_DayRender" ShowGridLines="True"
Width="330px">
<DayHeaderStyle Font-Bold="True" Font-Size="8pt"
ForeColor="#333333" Height="8pt" />
<DayStyle BackColor="#CCCCCC" />

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

<NextPrevStyle Font-Bold="True" Font-Size="8pt"


ForeColor="White" />
<OtherMonthDayStyle ForeColor="#999999" />
<SelectedDayStyle BackColor="#333399"
ForeColor="White" />
<TitleStyle BackColor="#333399" BorderStyle="Solid"
Font-Bold="True" Font-Size="12pt" ForeColor="White" Height="12pt" />
<TodayDayStyle BackColor="#999999" ForeColor="White"
/>
</asp:Calendar>
<br />
Your Selected Date:&nbsp; <asp:Label ID="Label1"
runat="server" Text="Label"></asp:Label>
<br />
Today&#39;s Date:
<asp:Label ID="Label2" runat="server"
Text="Label"></asp:Label>
<br />
GanpatiVacation Start:&nbsp;
<asp:Label ID="Label3" runat="server"
Text="Label"></asp:Label>
<br />
Days Remaining For Ganpati Vacation: <asp:Label
ID="Label4" runat="server" Text="Label"></asp:Label>
<br />
Days Remaining for New Year:<asp:Label ID="Label5"
runat="server" Text="Label"></asp:Label>
<br />
<br />
<asp:Button ID="btnResult" runat="server"
OnClick="btnResult_Click" Text="Result" />
&nbsp;
<asp:Button ID="btnReset" runat="server"
OnClick="btnReset_Click" Text="Reset" />
</div>

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

C# CODE:

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

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

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

protected void btnResult_Click(object sender, EventArgs e)


{
Calendar1.Caption = "MARIYAM";
Calendar1.FirstDayOfWeek = FirstDayOfWeek.Sunday;
Calendar1.NextPrevFormat = NextPrevFormat.ShortMonth;
Calendar1.TitleFormat = TitleFormat.Month;

Label2.Text = "Todays Date" +


Calendar1.TodaysDate.ToShortDateString();
Label3.Text = "Ganpati Vacation Start: 9-13-2021";
TimeSpan d = new DateTime(2021, 9, 13) - DateTime.Now;
Label4.Text = "Days Remaining For Ganpati Vacation:" +
d.Days.ToString();
TimeSpan d1 = new DateTime(2021, 12, 31) - DateTime.Now;
Label5.Text = "Days Remaining for New Year:" +
d1.Days.ToString();
if (Calendar1.SelectedDate.ToShortDateString() == "9-13-
2021")
Label3.Text = "<b>Ganpati Festival Start</b>";
if (Calendar1.SelectedDate.ToShortDateString() == "9-23-
2021")
Label3.Text = "<b>Ganpati Festival End</b>";
}

protected void Calendar1_DayRender(object


sender,DayRenderEventArgs e)
{
if (e.Day.Date.Day == 5 && e.Day.Date.Month == 9)
{
e.Cell.BackColor = System.Drawing.Color.Yellow;
Label lbl = new Label();
lbl.Text = "<br>Teachers Day!";
e.Cell.Controls.Add(lbl);
Image g1 = new Image();
g1.ImageUrl = "td.jpg";
g1.Height = 20;
g1.Width = 20;
e.Cell.Controls.Add(g1);
}

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

if (e.Day.Date.Day == 13 && e.Day.Date.Month == 9)


{
Calendar1.SelectedDate = new DateTime(2021, 9, 12);

Calendar1.SelectedDates.SelectRange(Calendar1.SelectedDate,
Calendar1.SelectedDate.AddDays(10));
Label lbl1 = new Label();
lbl1.Text = "<br>Ganpati!";
e.Cell.Controls.Add(lbl1);
}
}

protected void btnReset_Click(object sender, EventArgs e)


{
Label1.Text = "";
Label2.Text = "";
Label3.Text = "";
Label4.Text = "";
Label5.Text = "";
Calendar1.SelectedDates.Clear();
}
}
}

OUTPUT:

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

PRACTICAL 3(C):

AIM: Demonstrate the use of Treeview control perform following operations.

i. Treeview control and datalist


ii. Treeview operations

DESIGN:

HTML CODE:
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="WebForm1.aspx.cs" Inherits="practical3ca.WebForm1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
Treeview Control Navigation:<br />
<asp:TreeView ID="TreeView1" runat="server"
ImageSet="Arrows">
<HoverNodeStyle Font-Underline="True"
ForeColor="#5555DD" />
<Nodes>
<asp:TreeNode Text="ASP.NET Practs"
Value="ASP.NET Practs">
<asp:TreeNode Text="Calender Control"
Value="RED"></asp:TreeNode>
<asp:TreeNode Text="Constructor Overloading"
Value="GREEN"></asp:TreeNode>
<asp:TreeNode Text="Inheritance"
Value="BLUE"></asp:TreeNode>
<asp:TreeNode Text="Class properties"
Value="Class properties"></asp:TreeNode>
</asp:TreeNode>
</Nodes>
<NodeStyle Font-Names="Tahoma" Font-Size="10pt"
ForeColor="Black" HorizontalPadding="5px" NodeSpacing="0px"
VerticalPadding="0px" />
<ParentNodeStyle Font-Bold="False" />
<SelectedNodeStyle Font-Underline="True"
ForeColor="#5555DD" HorizontalPadding="0px" VerticalPadding="0px" />
</asp:TreeView>
<br />
Fetch Datalist Using XML Data:<br />
<asp:DataList ID="DataList1" runat="server">
<ItemTemplate>
<table class="table" border="1">
<tr>
<td> Roll Num : <%# Eval("sid") %> <br
/>
Name : <%# Eval("sname") %> <br />
Class : <%# Eval("sclass") %> <br />
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
</div>
</form>
</body>

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

</html>

C# CODE:
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;

namespace practical3ca
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindData();
}
}
protected void BindData()
{
DataSet ds = new DataSet();
ds.ReadXml(Server.MapPath("stdetail.xml"));
if (ds != null && ds.HasChanges())
{
DataList1.DataSource = ds;
DataList1.DataBind();
}
else
{
DataList1.DataBind();
}

}
}

XML FILE:
<?xml version="1.0" encoding="utf-8" ?>
<studentdetail>
<student>

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

<sid>1</sid>
<sname>Mariyam</sname>
<sclass>TYIT</sclass>
</student>
<student>
<sid>2</sid>
<sname>Anam</sname>
<sclass>TYIT</sclass>
</student>
<student>
<sid>3</sid>
<sname>Fatima</sname>
<sclass>TYCS</sclass>
</student>
<student>
<sid>4</sid>
<sname>Afreen</sname>
<sclass>TYCS</sclass>
</student>
</studentdetail>

OUTPUT:

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

PRACTICAL 4: Working with Form Controls

PRACTICAL 4(A):

AIM: Create a Registration form to demonstrate use of various Validation


controls.

DESIGN:

HTML CODE:
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="WebForm1.aspx.cs" Inherits="Practical4a.WebForm1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script runat="server">
void ValidateBtn_OnClick(Object sender,EventArgs e)
{
if(Page.IsValid)
{
lbl1.Text = "Thank You!";
}
else
{

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

lbl1.Text = "The text must be exactly 8 character


long!";
}
}
void ServerValidation(object source,ServerValidateEventArgs
e)
{
if (e.Value.Length == 8)
e.IsValid = true;
else
e.IsValid = false;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
Your Name:<br />
<asp:TextBox ID="txtName" runat="server"></asp:TextBox>
&nbsp;
<asp:RequiredFieldValidator ID="reqName" runat="server"
ControlToValidate="txtName" ErrorMessage="Please enter your name!"
ForeColor="Red"></asp:RequiredFieldValidator>
<br />
<br />
Enter Age:<br />
<asp:TextBox ID="txt1" runat="server"></asp:TextBox>
&nbsp;
<asp:RangeValidator ID="RangeValidator2" runat="server"
ControlToValidate="txt1" ErrorMessage="Not valid age"
ForeColor="Red" MaximumValue="100" MinimumValue="18"
Type="Integer"></asp:RangeValidator>
<br />
<br />
Password:<br />
<asp:TextBox ID="txt11" runat="server"
TextMode="Password"></asp:TextBox>
&nbsp;
<br />
ReEnter Password:<br />
<asp:TextBox ID="txt12" runat="server"
TextMode="Password"></asp:TextBox>
&nbsp;
<asp:CompareValidator ID="cmpNumbers" runat="server"
ControlToCompare="txt11" ControlToValidate="txt12"
ErrorMessage="Password should match!" ForeColor="Red"
Operator="LessThan" Type="Integer"></asp:CompareValidator>
<br />
<br />

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

Email ID:<br />


<asp:TextBox ID="txtNumber"
runat="server"></asp:TextBox>
&nbsp;
<asp:RegularExpressionValidator ID="rexNumber"
runat="server" ControlToValidate="txtNumber" ErrorMessage="Please
enter valid email address!" ForeColor="Red"
ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+
([-.]\w+)*"></asp:RegularExpressionValidator>
<br />
Custom text:<br />
<asp:TextBox ID="txtCustom"
runat="server"></asp:TextBox>
&nbsp;
<asp:CustomValidator ID="CustomValidator1"
runat="server" ClientValidationFunction="ServerValidation"
ControlToValidate="txtCustom" ErrorMessage="The text must be exactly
8 character long!" ForeColor="Red"></asp:CustomValidator>
<br />
<asp:Button ID="Button1" runat="server"
OnClientClick="ValidateBtn_OnClick" Text="Validate" />
<br />
<asp:ValidationSummary ID="ValidationSummary1"
runat="server" Height="38px" Width="625px" />
<br />
<asp:Label ID="lbl1" runat="server"></asp:Label>
</div>
</form>
</body>
</html>
C# CODE:
Website.config:
<?xml version="1.0" encoding="utf-8"?>

<!--
For more information on how to configure your ASP.NET application,
please visit
https://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<appSettings>
<add key="ValidationSettings:UnobtrusiveValidationMode"
value="None"/>
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5.2"/>
<httpRuntime targetFramework="4.5.2"/>

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

</system.web>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs"

type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeP
rovider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
warningLevel="4" compilerOptions="/langversion:6
/nowarn:1659;1699;1701"/>
<compiler language="vb;vbs;visualbasic;vbscript"
extension=".vb"

type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvi
der, Microsoft.CodeDom.Providers.DotNetCompilerPlatform,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
warningLevel="4" compilerOptions="/langversion:14
/nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+"/>
</compilers>
</system.codedom>

</configuration>

OUTPUT:

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

PRACTICAL 4(B):
AIM: Create Web Form to demonstrate use of Adrotator Control.
Add a XML file, name it "adds.xml"

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

Add images to test out the adrotator functionality

DESIGN:

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

HTML CODE:
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="Default.aspx.cs" Inherits="Practical4b.Default" %>

<!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" />
<asp:XmlDataSource ID="XmlDataSource1" runat="server"
DataFile="~/adds.xml"></asp:XmlDataSource>
</div>
</form>
</body>
</html>

XML FILE:
<?xml version="1.0" encoding="utf-8" ?>
<Advertisements>
<Ad>
<ImageUrl>ROSE.jpg</ImageUrl>
<NavigateUrl></NavigateUrl>
<AlternateText>flower</AlternateText>
<Impressions>20</Impressions>
<Keyword>flowers</Keyword>
</Ad>
<Ad>
<ImageUrl>sunflower.jpg</ImageUrl>
<NavigateUrl></NavigateUrl>
<AlternateText>flower</AlternateText>
<Impressions>20</Impressions>
<Keyword>flower</Keyword>

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

</Ad>
<Ad>
<ImageUrl>orchids.jpg</ImageUrl>
<NavigateUrl></NavigateUrl>
<AlternateText>flower</AlternateText>
<Impressions>20</Impressions>
<Keyword>flower</Keyword>
</Ad>
</Advertisements>

OUTPUT:

PRACTICAL 4(C):

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

AIM: Create Web Form to demonstrate use User Controls


Add Web User Control

Website -> Add -> Web User Control and Name it ‘MyUserControl’

DESIGN:

HTML CODE:
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="MyUserControl.aspx.cs"
Inherits="practical4c.MyUserControl1" %>

<!DOCTYPE html>

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

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

<form id="form1" runat="server">


<div>
Name:
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br />
City :&nbsp;&nbsp;
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Button ID="Button1" runat="server"
OnClick="Button1_Click" Text="Save" />
<br />
<asp:Label ID="Label1" runat="server"
OnDataBinding="Button1_Click"></asp:Label>
</div>
</form>
</body>
</html>

MyUserControl.ascx:
<%@ Control Language="C#" AutoEventWireup="true"
CodeBehind="MyUserControl.ascx.cs" Inherits="practical4c.MyUserControl" %>
<h3>This is User Contro1 </h3>
<table>

<tr>
<td>Name</td>
<td>

<asp:TextBox ID="txtName" runat="server"></asp:TextBox>


</td>
</tr>
<tr>
<td>City</td>
<td><asp:TextBox ID="txtcity" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td></td>
<td>
</td>
</tr>
<tr>
<td></td>

<td>
<asp:Button ID="txtSave" runat="server" Text="Save"
onclick="txtSave_Click" />
</td>
</tr>
</table><br />

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

<asp:Label ID="Label1" runat="server" ForeColor="White"


Text=" "></asp:Label>

C# CODE:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

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

protected void Button1_Click(object sender, EventArgs e)


{
Label1.Text = "Your Name Is" + TextBox1.Text + "And You
Are From" + TextBox2.Text;
}
}
}

OUTPUT:

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

PRACTICAL 5: Working with Navigation, Beautification and Master page

. PRACTICAL 5(A):

AIM: Create Web Form to demonstrate use of Website Navigation controls and
Site Map.
Add Site Map File

Website-> Add ->Site Map and Name it ‘Web.sitemap’.

DESIGN:

HTML CODE:
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="default1.aspx.cs" Inherits="practica5a.default1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:SiteMapPath ID="SiteMapPath1" runat="server">
</asp:SiteMapPath>
</div>
</form>
</body>
</html>

C# CODE:
Web.sitemap:
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-
1.0" >
<siteMapNode url="practical5a.aspx" title="Home"
description="Home page of our website">
<siteMapNode url="default1.aspx" title="Page2"
description="Page2" />
<siteMapNode url="default2.aspx" title="Page3"
description="Page3" />
<siteMapNode url="default3.aspx" title="Page4"
description="Page4" />
</siteMapNode>
</siteMap>

OUTPUT:

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

PRACTICAL 5(B):

AIM: Create a web application to demonstrate use of Master Page with


applying Styles and Themes for page beautification.

DESIGN:

SkinFile1.skin:
<asp:Lable runat="server" ForeColor="red" Font-Size="14pt" Font-
Name="Verdana" />
<asp:Button runat="server" BorderStyle="solod"
Boederwidth="2px" Bordercolor="Blue"
Backcolor="Magenta" />

HTML CODE:
Demostyle.css:
body {
background-color:yellow;
font-family:Cambria;
font-size:18px;
}

MasterPage.master:

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

<%@ Master Language="C#" AutoEventWireup="true"


CodeBehind="MasterPage.master.cs" Inherits="practical5B.MasterPage"
%>

<!DOCTYPE html>

<html>
<head runat="server">
<title></title>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
<link href="css/my.css" rel="demostyle.css" type="text/css"/>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1"
runat="server">
</asp:ContentPlaceHolder>

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

Demo.aspx:
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.Master"
AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs"
Inherits="practical5B.WebForm1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head"
runat="server">
</asp:Content>
<asp:Content ID="Content2"
ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<asp:Label ID="Label1" runat="server" Text="Advance Web
Programming "></asp:Label>
<br />
<br />
<asp:Label ID="Label2" runat="server" Text="Enterprise
Java"></asp:Label>
<br />
<br />
<asp:Label ID="Label3" runat="server" Text="Lable"></asp:Label>
<br />
<br />
<asp:Button ID="Button1" runat="server" Text="Demo"
OnClick="Button1_Click" />

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

<br />
<br />
<br />
</asp:Content>

C# CODE:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

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

protected void Button1_Click(object sender, EventArgs e)


{
Label3.Text = "Name : MARIYAM";
}
}
}

OUTPUT:

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

PRACTICAL 5(C):

AIM: Create a web application to demonstrate various states of ASP.NET


Pages

1. View State

DESIGN:

HTML CODE:
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="ViewState.aspx.cs" Inherits="practical5c.ViewState" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
ViewState Data:<asp:Label ID="lblStr"
runat="server"></asp:Label>
<br />
<asp:Button ID="Button1" runat="server"
OnClick="Button1_Click" style="height: 26px" Text="Get Data" />
</div>
</form>
</body>
</html>

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

C# CODE:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace practical5c
{
public partial class ViewState : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostBack)
{
string str = "Mariyam Shaikh";
if (ViewState["name"] == null) ;
{
ViewState["name"] = str;
}
}
}

protected void Button1_Click(object sender, EventArgs e)


{
lblStr.Text = ViewState["name"].ToString();

}
}
}

OUTPUT:

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

2. Query String
DESIGN:

HTML CODE:
QueryString.aspx
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="QueryString.aspx.cs" Inherits="practical5c.QueryString"
%>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
Query String :<br />
UserId:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:TextBox ID="txtUserId"
runat="server"></asp:TextBox>
<br />
UserName:
<asp:TextBox ID="txtUserName"
runat="server"></asp:TextBox>
<br />

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

<asp:Button ID="btnSend" runat="server"


OnClick="Button1_Click" Text="Send Values" />
</div>
</form>
</body>
</html>

QS.aspx

<%@ Page Language="C#" AutoEventWireup="true"


CodeBehind="QS.aspx.cs" Inherits="practical5c.QS" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
QueryString Parameters Values In QueryString.aspx
Page<br />
<br />
UserId:<asp:Label ID="lblUserId"
runat="server"></asp:Label>
<br />
<br />
UserName:<asp:Label ID="lblUserName"
runat="server"></asp:Label>
</div>
</form>
</body>
</html>

C# CODE:
QueryString.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace practical5c

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

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

protected void Button1_Click(object sender, EventArgs e)


{
Response.Redirect("QS.aspx?UserId=" + txtUserId.Text +
"&UserName=" + txtUserName.Text);
}
}
}

QS.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace practical5c
{
public partial class QS : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostBack)
{
lblUserId.Text = Request.QueryString["UserId"];
lblUserName.Text = Request.QueryString["UserName"];
}
}
}
}

OUTPUT

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

3. Cookies
DESIGN:

HTML CODE:
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="cookie.aspx.cs" Inherits="practical5c.cookie" %>

<!DOCTYPE html>

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

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

<asp:DropDownList ID="ColorSelector" runat="server"


AutoPostBack="True"
OnSelectedIndexChanged="ColorSelector_IndexChanged"
OnTextChanged="ColorSelector_IndexChanged">
<asp:ListItem Value="White" Selected="True">Select
color...</asp:ListItem>
<asp:ListItem Value="Red">Red</asp:ListItem>
<asp:ListItem Value="Green">Green</asp:ListItem>
<asp:ListItem Value="Blue">Blue</asp:ListItem>
</asp:DropDownList>
</div>
</form>
</body>
</html>

C# CODE:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace practical5c
{
public partial class cookie : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if(Request.Cookies["BackgroundColor"]!=null)
{
ColorSelector.SelectedValue =
Request.Cookies["BackgroundColor"].Value;
BodyTag.Style["background-color"] =
ColorSelector.SelectedValue;
}
}

protected void ColorSelector_IndexChanged(object sender,


EventArgs e)
{
BodyTag.Style["background-color"] =
ColorSelector.SelectedValue;
HttpCookie cookie = new HttpCookie("BackgroundColor");
cookie.Value = ColorSelector.SelectedValue;

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

cookie.Expires = DateTime.Now.AddMilliseconds(20);
Response.SetCookie(cookie);
}
}
}

OUTPUT:

4.Session and Application:


1. Add a project and add webform
2. Add a Global.asax to the web application
DESIGN:

HTML CODE:
Default.aspx
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="Default.aspx.cs" Inherits="P5c.Default" %>

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
Visitor Count:<% =Application["OnlineUsers"].ToString()
%>
</div>
</form>
</body>
</html>

C# CODE:
Global.asax
<%@ Application Language="C#" %>
<script runat="server">
void Application_Start(object sender, EventArgs e)
{
Application["OnlineUsers"] = 0;
}
void Application_End(object sender, EventArgs e)
{

}
void Application_Error(object sender, EventArgs e)
{

}
void Session_start(object sender, EventArgs e)
{
Application.Lock();
Application["OnlineUsers"] = (int)Application["OnlineUsers"]
+ 1;
Application.UnLock();
}
void Session_End(object sender, EventArgs e)
{
Application.Lock();
Application["OnlineUsers"] = (int)Application["OnlineUsers"]
- 1;
Application.UnLock();
}
</script>

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

OUTPUT:

PRACTICAL 6: Working with Database

PRACTICAL 6(A):

AIM: Create a web application bind data in a multiline


textbox by querying in another textbox
DESIGN:

HTML CODE:
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="default.aspx.cs" Inherits="Practical6a._default" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server" Height="84px"
TextMode="MultiLine" Width="578px"></asp:TextBox>
<br />
<br />
<asp:Button ID="Button1" runat="server"
OnClick="Button1_Click" Text="Execute Query" />
<br />
<br />
<asp:TextBox ID="TextBox2" runat="server" Height="236px"
TextMode="MultiLine" Width="587px"></asp:TextBox>
<br />
<br />
<asp:SqlDataSource ID="SqlDataSource1"
runat="server"></asp:SqlDataSource>
</div>
</form>
</body>
</html>

Web.config:
<?xml version="1.0" encoding="utf-8"?>

<!--
For more information on how to configure your ASP.NET application,
please visit
https://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.5.2"/>
<httpRuntime targetFramework="4.5.2"/>
</system.web>
<connectionStrings>
<add name="connStr" connectionString="Data
Source=DESKTOP123\TEW_SQLEXPRESS;Initial Catalog=Customer;Integrated
Security=True;Pooling=False" />
</connectionStrings>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs"

type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeP

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

rovider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
warningLevel="4" compilerOptions="/langversion:6
/nowarn:1659;1699;1701"/>
<compiler language="vb;vbs;visualbasic;vbscript"
extension=".vb"

type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvi
der, Microsoft.CodeDom.Providers.DotNetCompilerPlatform,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
warningLevel="4" compilerOptions="/langversion:14
/nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+"/>
</compilers>
</system.codedom>

</configuration>

C# CODE:
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;

namespace Practical6a
{
public partial class _default : System.Web.UI.Page
{

protected void Page_Load(object sender, EventArgs e)


{

protected void Button1_Click(object sender, EventArgs e)


{
string connStr =
ConfigurationManager.ConnectionStrings["connStr"].ConnectionString;
SqlConnection con = new SqlConnection(connStr);
con.Open();
SqlCommand cmd = new SqlCommand(TextBox1.Text, con);
SqlDataReader reader = cmd.ExecuteReader();

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

TextBox2.Text = "";
while (reader.Read())
{
//To add new blank line in the text area
TextBox2.Text += Environment.NewLine;

for (int i = 0; i < reader.FieldCount - 1; i++)


{
TextBox2.Text +=
reader[i].ToString().PadLeft(15);
}
}
reader.Close();
con.Close();
}
}
}

OUTPUT:

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

PRACTICAL 6(B):

AIM: Create a web application to display records by using


database.
DESIGN:

HTML CODE:
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="default2.aspx.cs" Inherits="Practical6a.default2" %>

<!DOCTYPE html>

<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="Cutomer
Details :"></asp:Label>
<br />
<br />
<asp:Label ID="Label2" runat="server"></asp:Label>
<br />
<br />
<br />
<asp:Button ID="Button1" runat="server"
OnClick="Button1_Click" Text="Display Records" />
</div>
</form>

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

</body>
</html>

C# CODE:
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;

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

protected void Button1_Click(object sender, EventArgs e)


{
string connStr =

ConfigurationManager.ConnectionStrings["connStr"].ConnectionString;
SqlConnection con = new SqlConnection(connStr);
SqlCommand cmd = new SqlCommand("Select FirstName,
LastName, Country from Customer", con);
con.Open();
SqlDataReader reader = cmd.ExecuteReader();

while(reader.Read())
{
Label2.Text += reader["FirstName"].ToString( ) + "
" + reader["LastName"].ToString( ) + "Country:" +
reader["Country"].ToString( ) + "<br";
}
reader.Close();
con.Close();

}
}
}

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

OUTPUT:

PRACTICAL 6(C):

AIM: Demonstrate the use of Datalist link control.


DESIGN:

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

HTML CODE:
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="default3.aspx.cs" Inherits="Practical6a.default3" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 808px;
height: 846px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div class="auto-style1">

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

<asp:DataList ID="DataList1" runat="server"


DataKeyField="Id" DataSourceID="SqlDataSource1">
<ItemTemplate>
Id:
<asp:Label ID="IdLabel" runat="server" Text='<%#
Eval("Id") %>' />
<br />
FirstName:
<asp:Label ID="FirstNameLabel" runat="server"
Text='<%# Eval("FirstName") %>' />
<br />
LastName:
<asp:Label ID="LastNameLabel" runat="server"
Text='<%# Eval("LastName") %>' />
<br />
City:
<asp:Label ID="CityLabel" runat="server" Text='<
%# Eval("City") %>' />
<br />
Country:
<asp:Label ID="CountryLabel" runat="server"
Text='<%# Eval("Country") %>' />
<br />
Phone:
<asp:Label ID="PhoneLabel" runat="server"
Text='<%# Eval("Phone") %>' />
<br />
<br />
</ItemTemplate>
</asp:DataList>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="Data Source=DESKTOP123\TEW_SQLEXPRESS;Initial
Catalog=Customer;Integrated Security=True"
ProviderName="System.Data.SqlClient" SelectCommand="SELECT [Id],
[FirstName], [LastName], [City], [Country], [Phone] FROM
[Customer]"></asp:SqlDataSource>
</div>
</form>
</body>
</html>

OUTPUT:

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

PRACTICAL 7: Working with Database

PRACTICAL 7(A):

AIM: Create a web application to display Databinding using dropdownlist


control

DESIGN:

HTML CODE:
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="default5.aspx.cs" Inherits="Practical6a.default5" %>

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
&nbsp;&nbsp;
<asp:DropDownList ID="DropDownList1" runat="server"
DataSourceID="SqlDataSource1" DataTextField="Country"
DataValueField="Country">
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:CustomerConnectionString %>"
SelectCommand="SELECT [Country] FROM
[Customer]"></asp:SqlDataSource>
<br />
&nbsp;<asp:Button ID="Button1" runat="server"
OnClick="Button1_Click" Text="Click Me !" />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Label ID="Label1" runat="server" Text="The Country
You Have Selected Is :"></asp:Label>
</div>
</form>
</body>
</html>

C# CODE:
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;

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

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

protected void Button1_Click(object sender, EventArgs e)


{
if (IsPostBack == false)
{
string connStr =

ConfigurationManager.ConnectionStrings["connStr"].ConnectionString;
SqlConnection con = new SqlConnection(connStr);
SqlCommand cmd = new SqlCommand("Select Distinct
Country from Customer", con);
con.Open();
SqlDataReader reader = cmd.ExecuteReader();
DropDownList1.DataSource = reader;
DropDownList1.DataTextField = "Country";
DropDownList1.DataBind();
reader.Close();
con.Close();

}
Label1.Text = "The Country You Have Selected Is :" +
DropDownList1.SelectedValue;
}
}
}

OUTPUT:

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

PRACTICAL 7(B):

AIM: Create a web application for to display the phone no of an author using
database

DESIGN:

HTML CODE:
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="PhoneNo.aspx.cs" Inherits="Practical6a.PhoneNo" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
Select Your Name To Get Phone Number:<br />
<asp:DropDownList ID="DropDownList1" runat="server">
</asp:DropDownList>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Button ID="Button1" runat="server"
OnClick="Button1_Click" Text="Get Phone No." />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Label ID="Label1" runat="server" Text="Your Phone
Number Is :"></asp:Label>
</form>
</body>
</html>

C# CODE:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;

namespace Practical7b
{
public partial class PhoneNo : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if(IsPostBack==false)
{
string connStr=

ConfigurationManager.ConnectionStrings["connStr"].ConnectionString;
SqlConnection con = new SqlConnection(connStr);
SqlCommand cmd = new SqlCommand("Select Distinct
FirstName,LastName,Phone from Customer", con);
con.Open();
SqlDataReader reader = cmd.ExecuteReader();
DropDownList1.DataSource = reader;
DropDownList1.DataTextField = "FirstName";
DropDownList1.DataValueField = "Phone";
DropDownList1.DataBind();
reader.Close();
con.Close();

}
}

protected void Button1_Click(object sender, EventArgs e)


{
Label1.Text = "Your Phone Number Is :" +
DropDownList1.SelectedValue;
}
}
}

OUTPUT:

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

PRACTICAL 7(C):

AIM: Create a web application for inserting and deleting record from a
database. (Using Execute-Non Query).

DESIGN:

HTML CODE:
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="WebForm1.aspx.cs" Inherits="practical7c.WebForm1" %>

<!DOCTYPE html>

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 100%;
}
.auto-style2 {
width: 128px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<table class="auto-style1">
<tr>
<td class="auto-style2">AccountNumber:</td>
<td>
<asp:TextBox ID="TextBox1"
runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">CustomerName:</td>
<td>
<asp:TextBox ID="TextBox2"
runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">BankBranchName:</td>
<td>
<asp:TextBox ID="TextBox3"
runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">State:</td>
<td>
<asp:TextBox ID="TextBox4"
runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">Zipcode:</td>
<td>
<asp:TextBox ID="TextBox5"
runat="server"></asp:TextBox>

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Button ID="Button1" runat="server"
OnClick="Button1_Click" Text="Insert" />
</td>
<td>
<asp:Button ID="Button2" runat="server"
OnClick="Button2_Click" style="height: 26px" Text="Delete" />
</td>
</tr>
<tr>
<td colspan="2">
<asp:Label ID="Label1"
runat="server"></asp:Label>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>

C# CODE:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Data.SqlClient;

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

protected void Button1_Click(object sender, EventArgs e)


{
string connStr =
ConfigurationManager.ConnectionStrings["connStr"].ConnectionString;

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

SqlConnection con = new SqlConnection(connStr);


string insertquery = "insert into Bank
values(@AccountNumber,@CustomerName,@BankbranchName,@State,@Zipcode)
";
SqlCommand cmd = new SqlCommand(insertquery, con);
cmd.Parameters.AddWithValue("@AccountNumber",
TextBox1.Text);
cmd.Parameters.AddWithValue("@CustomerName",
TextBox2.Text);
cmd.Parameters.AddWithValue("@BankBranchName",
TextBox3.Text);
cmd.Parameters.AddWithValue("@State", TextBox4.Text);
cmd.Parameters.AddWithValue("@Zipcode", TextBox5.Text);
con.Open();
cmd.ExecuteNonQuery();
Label1.Text = "Record Inserted Scuessfully";
con.Close();

protected void Button2_Click(object sender, EventArgs e)


{
string connStr =
ConfigurationManager.ConnectionStrings["connStr"].ConnectionString;
SqlConnection con = new SqlConnection(connStr);
string InsertQuery = "delete from Bank where
AccountNumber=@AccountNumber";
SqlCommand cmd = new SqlCommand(InsertQuery, con);
cmd.Parameters.AddWithValue("@AccountNumber",
TextBox1.Text);
con.Open();
cmd.ExecuteNonQuery();
Label1.Text = "Record Deleted Successfuly.";
con.Close();

}
}
}

OUTPUT:

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

PRACTICAL 8: Working with Data Controls

PRACTICAL 8(A):

AIM: Create a web application to demonstrate various uses and properties of


SqlDataSource.
DESIGN:

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

HTML CODE:
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="WebForm2.aspx.cs" Inherits="Practical6a.WebForm2" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:DropDownList ID="DropDownList1" runat="server"
DataSourceID="SqlDataSource1" DataTextField="ProductName"
DataValueField="Id"
OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">
</asp:DropDownList>
<br />
<br />
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:CustomerConnectionString %>"
SelectCommand="SELECT [Id], [ProductName], [SupplierId],

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

[UnitPrice], [Package], [IsDiscontinued] FROM


[Product]"></asp:SqlDataSource>
<br />
<br />
<br />
<asp:DetailsView ID="DetailsView1" runat="server"
AutoGenerateRows="False" DataKeyNames="Id"
DataSourceID="SqlDataSource1" Height="50px" Width="125px">
<Fields>
<asp:BoundField DataField="Id" HeaderText="Id"
ReadOnly="True" SortExpression="Id" />
<asp:BoundField DataField="ProductName"
HeaderText="ProductName" SortExpression="ProductName" />
<asp:BoundField DataField="SupplierId"
HeaderText="SupplierId" SortExpression="SupplierId" />
<asp:BoundField DataField="UnitPrice"
HeaderText="UnitPrice" SortExpression="UnitPrice" />
<asp:BoundField DataField="Package"
HeaderText="Package" SortExpression="Package" />
<asp:CheckBoxField DataField="IsDiscontinued"
HeaderText="IsDiscontinued" SortExpression="IsDiscontinued" />
</Fields>
</asp:DetailsView>
</div>
</form>
</body>
</html>

C# CODE:
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;

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

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

protected void DropDownList1_SelectedIndexChanged(object


sender, EventArgs e)
{
SqlDataSource1.SelectCommand = "Select * from Product
where ProductName=" + DropDownList1.SelectedValue + "";
}
}
}

OUTPUT:

PRACTICAL 8(B):

AIM: Create a web application to demonstrate data binding using DetailsView


and FormView Control.

DESIGN:

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

HTML CODE:
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="practical8b.aspx.cs" Inherits="Practical6a.practical8b"
%>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<asp:DetailsView ID="DetailsView1" runat="server"
AutoGenerateRows="False" DataKeyNames="Id"
DataSourceID="SqlDataSource1" Height="50px" Width="125px">
<Fields>
<asp:BoundField DataField="Id" HeaderText="Id"
ReadOnly="True" SortExpression="Id" />
<asp:BoundField DataField="FirstName"
HeaderText="FirstName" SortExpression="FirstName" />
<asp:BoundField DataField="LastName"
HeaderText="LastName" SortExpression="LastName" />
<asp:BoundField DataField="City" HeaderText="City"
SortExpression="City" />
<asp:BoundField DataField="Country"
HeaderText="Country" SortExpression="Country" />
<asp:BoundField DataField="Phone" HeaderText="Phone"
SortExpression="Phone" />
</Fields>
</asp:DetailsView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:CustomerConnectionString %>"
SelectCommand="SELECT [Id], [FirstName], [LastName], [City],
[Country], [Phone] FROM [Customer]"></asp:SqlDataSource>
<asp:FormView ID="FormView1" runat="server"
BackColor="#CCCCCC" BorderColor="#999999" BorderStyle="Solid"
BorderWidth="3px" CellPadding="4" CellSpacing="2" DataKeyNames="Id"
DataSourceID="SqlDataSource2" ForeColor="Black" GridLines="Both">
<EditItemTemplate>
Id:
<asp:Label ID="IdLabel1" runat="server" Text='<%#
Eval("Id") %>' />
<br />
ProductName:
<asp:TextBox ID="ProductNameTextBox" runat="server"
Text='<%# Bind("ProductName") %>' />
<br />

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

SupplierId:
<asp:TextBox ID="SupplierIdTextBox" runat="server"
Text='<%# Bind("SupplierId") %>' />
<br />
UnitPrice:
<asp:TextBox ID="UnitPriceTextBox" runat="server"
Text='<%# Bind("UnitPrice") %>' />
<br />
Package:
<asp:TextBox ID="PackageTextBox" runat="server"
Text='<%# Bind("Package") %>' />
<br />
IsDiscontinued:
<asp:CheckBox ID="IsDiscontinuedCheckBox"
runat="server" Checked='<%# Bind("IsDiscontinued") %>' />
<br />
<asp:LinkButton ID="UpdateButton" runat="server"
CausesValidation="True" CommandName="Update" Text="Update" />
&nbsp;<asp:LinkButton ID="UpdateCancelButton"
runat="server" CausesValidation="False" CommandName="Cancel"
Text="Cancel" />
</EditItemTemplate>
<EditRowStyle BackColor="#000099" Font-Bold="True"
ForeColor="White" />
<FooterStyle BackColor="#CCCCCC" />
<HeaderStyle BackColor="Black" Font-Bold="True"
ForeColor="White" />
<InsertItemTemplate>
Id:
<asp:TextBox ID="IdTextBox" runat="server" Text='<%#
Bind("Id") %>' />
<br />
ProductName:
<asp:TextBox ID="ProductNameTextBox" runat="server"
Text='<%# Bind("ProductName") %>' />
<br />
SupplierId:
<asp:TextBox ID="SupplierIdTextBox" runat="server"
Text='<%# Bind("SupplierId") %>' />
<br />
UnitPrice:
<asp:TextBox ID="UnitPriceTextBox" runat="server"
Text='<%# Bind("UnitPrice") %>' />
<br />
Package:
<asp:TextBox ID="PackageTextBox" runat="server"
Text='<%# Bind("Package") %>' />
<br />
IsDiscontinued:

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

<asp:CheckBox ID="IsDiscontinuedCheckBox"
runat="server" Checked='<%# Bind("IsDiscontinued") %>' />
<br />
<asp:LinkButton ID="InsertButton" runat="server"
CausesValidation="True" CommandName="Insert" Text="Insert" />
&nbsp;<asp:LinkButton ID="InsertCancelButton"
runat="server" CausesValidation="False" CommandName="Cancel"
Text="Cancel" />
</InsertItemTemplate>
<ItemTemplate>
Id:
<asp:Label ID="IdLabel" runat="server" Text='<%#
Eval("Id") %>' />
<br />
ProductName:
<asp:Label ID="ProductNameLabel" runat="server"
Text='<%# Bind("ProductName") %>' />
<br />
SupplierId:
<asp:Label ID="SupplierIdLabel" runat="server"
Text='<%# Bind("SupplierId") %>' />
<br />
UnitPrice:
<asp:Label ID="UnitPriceLabel" runat="server"
Text='<%# Bind("UnitPrice") %>' />
<br />
Package:
<asp:Label ID="PackageLabel" runat="server" Text='<
%# Bind("Package") %>' />
<br />
IsDiscontinued:
<asp:CheckBox ID="IsDiscontinuedCheckBox"
runat="server" Checked='<%# Bind("IsDiscontinued") %>'
Enabled="false" />
<br />

</ItemTemplate>
<PagerStyle BackColor="#CCCCCC" ForeColor="Black"
HorizontalAlign="Left" />
<RowStyle BackColor="White" />
</asp:FormView>
<asp:SqlDataSource ID="SqlDataSource2" runat="server"
ConnectionString="<%$ ConnectionStrings:CustomerConnectionString %>"
SelectCommand="SELECT [Id], [ProductName], [SupplierId],
[UnitPrice], [Package], [IsDiscontinued] FROM
[Product]"></asp:SqlDataSource>
</form>
</body>
</html>

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

OUTPUT:

PRACTICAL 8(C):

AIM: Create a web application to display Using Disconnected Data Access and
Databinding using GridView

DESIGN:

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

HTML CODE:
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="disconnectedmodel.aspx.cs"
Inherits="Practical8c.disconnectedmodel" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
text-align: left;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<div class="auto-style1">
<asp:Button ID="Button1" runat="server"
OnClick="Button1_Click" Text="Show Disconnect Fetched Data" />
<br />
</div>

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

<asp:GridView ID="GridView1" runat="server"


AutoGenerateColumns="False" BackColor="White" BorderColor="#336666"
BorderStyle="Double" BorderWidth="3px" CellPadding="4"
DataKeyNames="Id" DataSourceID="SqlDataSource1"
GridLines="Horizontal">
<Columns>
<asp:BoundField DataField="Id" HeaderText="Id"
ReadOnly="True" SortExpression="Id" />
<asp:BoundField DataField="FirstName"
HeaderText="FirstName" SortExpression="FirstName" />
<asp:BoundField DataField="LastName"
HeaderText="LastName" SortExpression="LastName" />
<asp:BoundField DataField="City"
HeaderText="City" SortExpression="City" />
<asp:BoundField DataField="Country"
HeaderText="Country" SortExpression="Country" />
<asp:BoundField DataField="Phone"
HeaderText="Phone" SortExpression="Phone" />
</Columns>
<FooterStyle BackColor="White" ForeColor="#333333"
/>
<HeaderStyle BackColor="#336666" Font-Bold="True"
ForeColor="White" />
<PagerStyle BackColor="#336666" ForeColor="White"
HorizontalAlign="Center" />
<RowStyle BackColor="White" ForeColor="#333333" />
<SelectedRowStyle BackColor="#339966" Font-
Bold="True" ForeColor="White" />
<SortedAscendingCellStyle BackColor="#F7F7F7" />
<SortedAscendingHeaderStyle BackColor="#487575" />
<SortedDescendingCellStyle BackColor="#E5E5E5" />
<SortedDescendingHeaderStyle BackColor="#275353" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnStr %>"
SelectCommand="SELECT [Id], [FirstName], [LastName], [City],
[Country], [Phone] FROM [Customer]"></asp:SqlDataSource>
</div>
</form>
</body>
</html>

C# CODE:
using System;
using System.Collections.Generic;

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
using System.Configuration;
namespace Practical8c
{
public partial class disconnectedmodel : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

protected void Button1_Click(object sender, EventArgs e)


{
string connStr =

ConfigurationManager.ConnectionStrings["connStr"].ConnectionString;
SqlConnection conn = new SqlConnection(connStr);
SqlDataAdapter objDa = new SqlDataAdapter();
DataSet objDs = new DataSet();
using (SqlConnection objConn = new
SqlConnection(connStr))
{
SqlCommand objCmd = new SqlCommand("Select * from
Customer", objConn);
objDa.SelectCommand = objCmd;
objDa.Fill(objDs, "Customer");
GridView1.DataSource = objDs.Tables[0];
GridView1.DataBind();
}
conn.Open();
SqlDataAdapter da = new SqlDataAdapter("select * from
Customer", conn);
DataSet dst = new DataSet();
da.Fill(dst);
GridView1.DataSource = dst;
GridView1.DataBind();
}
}
}

OUTPUT:

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

PRACTICAL 9: Working with GridView control


PRACTICAL 9(A):

AIM: Create a web application to demonstrate use of GridView control


template and GridView hyperlink

DESIGN:

HTML CODE:
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="WebForm1.aspx.cs" Inherits="Practical9.WebForm1" %>

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:GridView ID="GridView1" runat="server"
AutoGenerateColumns="False" BackColor="White" BorderColor="#999999"
BorderStyle="Solid" BorderWidth="1px" CellPadding="3"
DataKeyNames="Id" DataSourceID="SqlDataSource1" ForeColor="Black"
GridLines="Vertical">
<AlternatingRowStyle BackColor="#CCCCCC" />
<Columns>
<asp:HyperLinkField DataNavigateUrlFields="Id"
DataTextField="Id" />
<asp:BoundField DataField="FirstName"
HeaderText="FirstName" SortExpression="FirstName" />
<asp:BoundField DataField="LastName"
HeaderText="LastName" SortExpression="LastName" />
<asp:BoundField DataField="City"
HeaderText="City" SortExpression="City" />
<asp:BoundField DataField="Country"
HeaderText="Country" SortExpression="Country" />
<asp:BoundField DataField="Phone"
HeaderText="Phone" SortExpression="Phone" />
</Columns>
<FooterStyle BackColor="#CCCCCC" />
<HeaderStyle BackColor="Black" Font-Bold="True"
ForeColor="White" />
<PagerStyle BackColor="#999999" ForeColor="Black"
HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#000099" Font-
Bold="True" ForeColor="White" />
<SortedAscendingCellStyle BackColor="#F1F1F1" />
<SortedAscendingHeaderStyle BackColor="Gray" />
<SortedDescendingCellStyle BackColor="#CAC9C9" />
<SortedDescendingHeaderStyle BackColor="#383838" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="Data Source=DESKTOP123\TEW_SQLEXPRESS;Initial
Catalog=Customer;Integrated Security=True"
ProviderName="System.Data.SqlClient" SelectCommand="SELECT [Id],
[FirstName], [LastName], [City], [Country], [Phone] FROM
[Customer]"></asp:SqlDataSource>
</div>

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

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

OUTPUT:

PRACTICAL 9(B):

AIM: Create a web application to demonstrate use of GridView button column


and GridView events.

DESIGN:

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

HTML CODE:
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="gridview.aspx.cs" Inherits="practical9b.gridview" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:GridView ID="GridView1" runat="server"
AllowPaging="True" AutoGenerateColumns="False" DataKeyNames="Id"
DataSourceID="SqlDataSource1">
<Columns>
<asp:BoundField DataField="Id" HeaderText="Id"
ReadOnly="True" SortExpression="Id" />
<asp:BoundField DataField="FirstName"
HeaderText="FirstName" SortExpression="FirstName" />
<asp:BoundField DataField="LastName"
HeaderText="LastName" SortExpression="LastName" />
<asp:BoundField DataField="City"
HeaderText="City" SortExpression="City" />

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

<asp:BoundField DataField="Country"
HeaderText="Country" SortExpression="Country" />
<asp:BoundField DataField="Phone"
HeaderText="Phone" SortExpression="Phone" />
<asp:CommandField ButtonType="Button"
HeaderText="Edit" ShowEditButton="True" ShowHeader="True" />
<asp:CommandField ButtonType="Button"
HeaderText="Delete" ShowDeleteButton="True" ShowHeader="True" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="Data Source=DESKTOP123\TEW_SQLEXPRESS;Initial
Catalog=Customer;Integrated Security=True" SelectCommand="SELECT *
FROM [Customer]" UpdateCommand="UPDATE Customer SET
FirstName=@FirstName,LastName=@LastName,City=@City,Country=@Country,
Phone=@phone Where Id=@Id">
<UpdateParameters>
<asp:Parameter Name="Id" Type="Int32" />
<asp:Parameter Name="FirstName" Type="String" />
<asp:Parameter Name="LastName" Type="String" />
<asp:Parameter Name="City" Type="String" />
<asp:Parameter Name="Country" Type="String" />
<asp:Parameter Name="Phone" Type="String" />

</UpdateParameters>
</asp:SqlDataSource>
</div>
</form>
</body>
</html>

OUTPUT:

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

PRACTICAL 9(C):

AIM: Create a web application to demonstrate GridView paging and Creating


own table format using GridView.
DESIGN:

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

HTML CODE:
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="WebForm1.aspx.cs" Inherits="Practical9c.WebForm1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:GridView ID="GridView1" runat="server"
BackColor="White" OnSorting="GridView1_Sorting"
BorderColor="#336666"
OnPageIndexChanged="GridView1_PageIndexChanging"
BorderStyle="Double" BorderWidth="3px" CellPadding="4"
GridLines="Horizontal" PageSize="5" style="z-index:1"
AllowSorting="true"
OnPageIndexChanging="GridView1_PageIndexChanging1"
OnSelectedIndexChanged="GridView1_SelectedIndexChanged" >
<FooterStyle BackColor="White" ForeColor="#333333"
/>
<HeaderStyle BackColor="#336666" Font-Bold="True"
ForeColor="White" />
<PagerStyle BackColor="#336666" ForeColor="White"
HorizontalAlign="Center" />
<RowStyle BackColor="White" ForeColor="#333333" />
<SelectedRowStyle BackColor="#339966" Font-
Bold="True" ForeColor="White" />
<SortedAscendingCellStyle BackColor="#F7F7F7" />
<SortedAscendingHeaderStyle BackColor="#487575" />
<SortedDescendingCellStyle BackColor="#E5E5E5" />
<SortedDescendingHeaderStyle BackColor="#275353" />
</asp:GridView>
</div>
</form>
</body>
</html>

C# CODE:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

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

namespace Practical9c
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
DemonstrateDataView();
}
}
private void DemonstrateDataView()
{
DataTable myTable = new DataTable("myTable");
DataColumn colItem1 = new DataColumn("Id",
Type.GetType("System.Int32"));
DataColumn colItem2 = new DataColumn("P_Name",
Type.GetType("System.String"));
DataColumn colItem3 = new DataColumn("Price",
Type.GetType("System.String"));
myTable.Columns.Add(colItem1);
myTable.Columns.Add(colItem2);
myTable.Columns.Add(colItem3);
DataRow NewRow;
for (int i = 0; i < 50; i++)
{
NewRow = myTable.NewRow();
NewRow["Id"] = i;
NewRow["P_Name"] = "Product" + i;
NewRow["Price"] = (20 * (i + 1));
myTable.Rows.Add(NewRow);
}
GridView1.DataSource = myTable;
GridView1.AllowPaging = true;
GridView1.AllowSorting = true;
ViewState["dataTable"] = myTable;
ViewState["sortdr"] = "Asc";
GridView1.DataBind();
}

protected void GridView1_Sorting(object sender,


GridViewSortEventArgs e)
{
DataTable dtrslt = (DataTable)ViewState["dataTable"];

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

if (dtrslt.Rows.Count > 0)
{
if (Convert.ToString(ViewState["sortdr"]) == "Asc")
{
dtrslt.DefaultView.Sort = e.SortExpression +
"Desc";
ViewState["sortdr"] = "Asc";
}
else
{
dtrslt.DefaultView.Sort = e.SortExpression +
"Asc";
ViewState["sortdr"] = "Asc";
}
GridView1.DataSource = dtrslt;
GridView1.DataBind();
}
}

protected void GridView1_PageIndexChanging(object sender,


GridViewPageEventArgs e)
{

GridView1.PageIndex = e.NewPageIndex;
DemonstrateDataView();
}
}
}

OUTPUT:

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

PRACTICAL 10: Working with AJAX and XML


PRACTICAL 10(A):

AIM: Create a web application to demonstrate reading and writing operation


with XML.
DESIGN:

HTML CODE:
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="WebForm1.aspx.cs" Inherits="Practical10a.WebForm1" %>

<!DOCTYPE html>

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

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

<form id="form1" runat="server">


<div>
<asp:Label ID="Label1" runat="server"
Text="Label"></asp:Label>
<br />
<asp:Button ID="Button1" runat="server"
OnClick="Button1_Click" Text="XML Writer" />
<br />
<br />
<asp:ListBox ID="ListBox1" runat="server" Height="259px"
Width="292px"></asp:ListBox>
<br />
<asp:Button ID="Button2" runat="server"
OnClick="Button2_Click" Text="XML Reader" />
</div>
</form>
</body>
</html>

C# CODE:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml;

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

protected void Button1_Click(object sender, EventArgs e)


{
XmlTextWriter writer = new
XmlTextWriter("C:\\Users\\Farman\\Documents\\Visual Studio
2017\\Projects\\Practical10a\\Practical10a\\XMLFile1.xml",null);
writer.WriteStartDocument();
writer.WriteStartElement("Details","");
writer.WriteElementString("ID", "1");
writer.WriteElementString("Name", "Mariyam");
writer.WriteEndElement();

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

writer.WriteEndDocument();
writer.Close();
Label1.Text = "Data Write Sucessfully";
}

protected void Button2_Click(object sender, EventArgs e)


{
String xmlNode = "C:\\Users\\Farman\\Documents\\Visual
Studio 2017\\Projects\\Practical10a\\Practical10a\\XMLFile1.xml";
XmlReader xReader = XmlReader.Create(xmlNode);
while (xReader.Read())
{
switch(xReader.NodeType)
{
case XmlNodeType.Element:
ListBox1.Items.Add("<" + xReader.Name +
">");
break;
case XmlNodeType.Text:
ListBox1.Items.Add(xReader.Value);
break;
case XmlNodeType.EndElement:
ListBox1.Items.Add("<" + xReader.Name +
">");
break;
}
}
}
}
}

OUTPUT:

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

PRACTICAL 10(B):

AIM: Create a web application to demonstrate Form Security and Windows


Security with proper Authentication and Authorization properties

DESIGN:

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

HTML CODE:
Login.aspx
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="Login.aspx.cs" Inherits="practical10b.WebForm1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 100%;
}
.auto-style2 {
width: 188px;
}
.auto-style3 {
width: 188px;
height: 25px;
}
.auto-style4 {
height: 25px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<table class="auto-style1">
<tr>
<td class="auto-style2">User Name:</td>
<td>
<asp:TextBox ID="txtuser" runat="server"
Enabled="False"></asp:TextBox>
</td>

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

</tr>
<tr>
<td class="auto-style2">Password:</td>
<td>
<asp:TextBox ID="txtpwd"
runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Button ID="Button1" runat="server"
OnClick="Button1_Click" Text="Login" />
</td>
<td>&nbsp;</td>
</tr>
<tr>
<td class="auto-style3">
<asp:CheckBox ID="chkrem" runat="server" />
&nbsp;Remember Me</td>
<td class="auto-style4"></td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label1"
runat="server"></asp:Label>
</td>
<td>&nbsp;</td>
</tr>
</table>
</div>
</form>
</body>
</html>

Welcome.aspx
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="Welcome.aspx.cs" Inherits="practical10b.Welcome" %>

<!DOCTYPE html>

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

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

<asp:Label ID="Label1" runat="server"></asp:Label>


You HaveSucessfully Logined!!!</div>
</form>
</body>
</html>

C# CODE:
Login.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.Web.Security;

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

}
protected bool authenticate(String uname, String pass)
{
if (uname == "Mariyam")
{
if (pass == "Mariyam24")
return true;
}
return false;
}

protected void Button1_Click(object sender, EventArgs e)


{
if (authenticate(txtuser.Text, txtpwd.Text))
{

FormsAuthentication.RedirectFromLoginPage(txtuser.Text,
chkrem.Checked);
Session["Username"] = txtuser.Text;
Response.Redirect("Welcome.aspx");

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

else
{
Label1.Text = "Invalid user or password";
}

}
}
}

Welcome.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace practical10b
{
public partial class Welcome : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["Username"] != null)
{
Label1.Text = Session["Username"].ToString();
}

}
}
}

OUTPUT:

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

PRACTICAL 10(C):

AIM: Create a web application to demonstrate use of various Ajax controls.

DESIGN:

HTML CODE:
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="WebForm1.aspx.cs" Inherits="Practical10c.WebForm1" %>

<%@ Register Assembly="AjaxControlToolkit"


Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

<%@ Register Assembly="AjaxControlToolkit" Namespace="Practical10c"


TagPrefix="ajaxToolkit" %>
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<br />
<br />
<asp:TextBox ID="TextBox1" runat="server" Columns="80"
Rows="20" TextMode="MultiLine"></asp:TextBox>
<ajaxToolkit:HtmlEditorExtender
ID="TextBox1_HtmlEditorExtender" runat="server"
EnableSanitization="false" BehaviorID="TextBox1_HtmlEditorExtender"
TargetControlID="TextBox1">
<Toolbar>
<ajaxToolkit:Bold />
<ajaxToolkit:Copy />
<ajaxToolkit:CreateLink />
<ajaxToolkit:Delete />
<ajaxToolkit:Cut />
</Toolbar>
</ajaxToolkit:HtmlEditorExtender>
</div>
</form>
</body>
</html>

OUTPUT:

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

PRACTICAL 11: Programs to create and use DLL


DESIGN:

HTML CODE:
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="WebForm1.aspx.cs" Inherits="practical_11.WebForm1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="Button1" runat="server"
OnClick="Button1_Click" Text="Upper" />
&nbsp;&nbsp;&nbsp;
<asp:Button ID="Button2" runat="server"
OnClick="Button2_Click" Text="Lower" />
&nbsp;&nbsp;&nbsp;

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>


</div>
</form>
</body>
</html>
DLL FILE:
Mariyam.dll
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Mariyam
{
public class Class1
{
public String UpperConvert(String text)
{
return text.ToUpper();
}
public String LowerConvert(String text)
{
return text.ToLower();
}
}
}

C# CODE:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Mariyam;

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

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B


ADVANCE WEB PROGRAMMING PRACTICAL

protected void Button1_Click(object sender, EventArgs e)


{
Class1 c = new Class1();
TextBox1.Text = c.UpperConvert(TextBox1.Text);
}

protected void Button2_Click(object sender, EventArgs e)


{
Class1 c = new Class1();
TextBox1.Text = c.LowerConvert(TextBox1.Text);
}
}
}

OUTPUT:

Name: Shaikh Mariyam Hisamuddin Roll No: 83 TYIT-B

You might also like