Professional Documents
Culture Documents
INDEX
Practical Details Page No. Sign
No.
a.Create an application that obtains four int values from the user and
displays the product.
i. Function Overloading
ii. Inheritance (all types)
iii. Constructor overloading
iv. Interfaces
v. Using Delegates and events
vi. Exception handling
3. Working with Web Forms and Controls
1
ANKIT TYAGI; ROLL NO 8990
2
ANKIT TYAGI; ROLL NO 8990
3
ANKIT TYAGI; ROLL NO 8990
PRACTICAL NO: 1
WORKING WITH BASIC C# AND ASP .NET
1A] Create an application that obtains four int values from the user and displays
the product.
Code:
4
ANKIT TYAGI; ROLL NO 8990
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
Output:
Code:
5
ANKIT TYAGI; ROLL NO 8990
using System;
class Geeks
{
// Main Method
static void Main(string[] args)
{
// initialization of String
Name = "Shri";
// initialization of String
id = "33";
// initialization of String
mrk = "97";
// Displaying Result
Console.WriteLine("Name: {0}", Name);
Console.ReadLine();
Console.WriteLine("Id: {0}", id);
Console.ReadLine();
Console.WriteLine("Marks: {0}", mrk);
Console.ReadLine();
Console.WriteLine("Rank: {0}", rank);
Console.ReadLine();
}
}
6
ANKIT TYAGI; ROLL NO 8990
Output:
7
ANKIT TYAGI; ROLL NO 8990
1. Open Visual Studio then select "File" -> "New" -> "Project..." then select "Visual C#"
-> "Class library".
2. In the calculate class, write methods for the addition and subtraction of two
integers.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Calculation
{
public class calculate
{
//method used for Addition
public int Add(int a, int b)
{
return a + b;
}
8
ANKIT TYAGI; ROLL NO 8990
}
}
}
3. Build the solution (F6). If the build is successful then you will see a "calculation.dll"
file in the "bin/debug" directory of your project.
9
ANKIT TYAGI; ROLL NO 8990
Step 3 - Add a reference for the dll file, "calculation.dll", that we created earlier.
Right- click on the project and then click on "Add reference".
Step 4 - Add the namespace ("using calculation;") and write the code.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
10
ANKIT TYAGI; ROLL NO 8990
using System.Threading.Tasks;
using System.Windows.Forms;
using Calculation;
namespace WindowsFormsApplication3
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
Output:
1. Addition :
11
ANKIT TYAGI; ROLL NO 8990
2. Subtraction:
12
ANKIT TYAGI; ROLL NO 8990
Code:
using System;
class Operations
{
public void fibonacci()
{
int n1=0,n2=1,n3,i,num;
Console.Write("Enter size of fibonacci series: ");
num = int.Parse(Console.ReadLine());
Console.Write(n1+""+n2+"");
for(i=2;i<num;++i)
{
n3=n1+n2;
Console.Write(n3+"");
n1=n2;
n2=n3;
}
13
ANKIT TYAGI; ROLL NO 8990
14
ANKIT TYAGI; ROLL NO 8990
int num,copy,rev=0,rem,sumDigits=0;
Console.Write("Enter number:");
num = int.Parse(Console.ReadLine());
copy = num;
class practical
{
public static void Main()
{
int no;
Operations obj=new Operations();
Console.WriteLine("enter your choice");
Console.WriteLine("1.generate fibonacci series");
Console.WriteLine("2.test for prime numbers");
no=Convert.ToInt32(Console.ReadLine());
switch(no)
{
case 1:
obj.fibonacci();
break;
case 2:
obj.prime_no();
break;
case 3:
15
ANKIT TYAGI; ROLL NO 8990
obj.vowels();
break;
case 4:
obj.demofor();
break;
case 5:
obj.sum();
break;
default:
}
}
}
Output:
1. Fibonacci Series:
2. Prime Numbers:
16
ANKIT TYAGI; ROLL NO 8990
3. Vowels:
17
ANKIT TYAGI; ROLL NO 8990
18
ANKIT TYAGI; ROLL NO 8990
PRACTICAL 2
WORKING WITH OBJECT ORIENTED C# AND ASP .NET
19
ANKIT TYAGI; ROLL NO 8990
i. Function Overloading
ii. Inheritance (all types)
iii. Constructor overloading
iv. Interfaces
v. Using Delegates and events
vi. Exception handling
i. Function Overloading:
Code:
using System;
class Func
{
// Main Method
public static void Main(String[] args)
{
// Creating Object
Func ob = new Func();
20
ANKIT TYAGI; ROLL NO 8990
}
}
Output:
1. Single inheritance:
Code:
using System;
class A
{
public void show()
{
Console.WriteLine("This is parent class");
}
}
class B: A
{
public void print()
{
Console.WriteLine("this is child class");
}
}
class test
{
public static void Main(string[] args)
{
B s=new B();
s.show();
s.print();
Console.ReadLine();
}
21
ANKIT TYAGI; ROLL NO 8990
Output:
2. Multiple Inheritance:
Code:
using System;
interface I1
void show();
interface I2
void display();
class A:I1,I2
Console.ReadLine();
22
ANKIT TYAGI; ROLL NO 8990
Console.ReadLine();
class Program
A a=new A();
a.show();
a.display();
Output:
3. Multilevel inheritance:
23
ANKIT TYAGI; ROLL NO 8990
Code:
using System;
public class A
{
public void show()
{
Console.WriteLine("class A");
Console.ReadLine();
}
}
public class B: A
{
public void show1()
{
Console.WriteLine("class B");
Console.ReadLine();
}
}
public class C : B
{
public void show2()
{
Console.WriteLine("class C");
Console.ReadLine();
}
}
class multileveldemo{
public static void Main(string[] args)
{
C ob = new C();
ob.show();
ob.show1();
ob.show2();
Console.ReadLine();
}
}
24
ANKIT TYAGI; ROLL NO 8990
Output:
4. Hierarchical Inheritance:
Code:
using System;
class parent
{
public void display()
{
Console.WriteLine("This is parent");
Console.ReadLine();
}
}
class child1:parent
{
public void show1()
{
Console.WriteLine("THIS is first child");
Console.ReadLine();
}
}
class child2:parent
{
public void show2()
{
Console.WriteLine("this is second child");
Console.ReadLine();
}
}
class demo
{
public static void Main(string[] args)
{
child1 c1=new child1();
c1.display();
c1.show1();
child2 c2=new child2();
25
ANKIT TYAGI; ROLL NO 8990
c2.display();
c2.show2();
Console.ReadLine();
}
}
Output:
5. Hybrid Inheritance:
Code:
//Hybrid Inheritance
using System;
class parent
{
public void display()
{
Console.WriteLine("I am parent ");
}
}
class child1 : parent
{
public void display1()
{
26
ANKIT TYAGI; ROLL NO 8990
{
Console.WriteLine("I am 2nd child of parent");
}
}
class test
{
public static void Main(string[] args)
{
child1 c1=new child1();
c1.display();
c1.display1();
child2 c2=new child2();
c2.display();
c2.display2();
subchild s=new subchild();
s.display();
s.display1();
s.show();
Console.ReadLine();
}
}
Output:
Code:
using System;
class Demo
{
int a,b,c,d;
public Demo()
{
Console.WriteLine("this is default constructor");
}
public Demo(int x,int y)
{
a=x;
b=y;
27
ANKIT TYAGI; ROLL NO 8990
Output:
iv. Interfaces:
Code:
using System;
interface I1
{
void show();
}
interface I2
{
void display();
}
class A:I1,I2
{
public void show()
{
28
ANKIT TYAGI; ROLL NO 8990
Output:
Code:
using System;
namespace SampleApp
{
29
ANKIT TYAGI; ROLL NO 8990
obj1.MyEvent+=d;
obj1. MyEvent("Krutika");
Console.ReadLine();
}
}
}
Output:
Code:
using System;
public class excdemo
{
public static void Main(string[] args)
{
try
{
int a = 10;
int b = 0;
Console.WriteLine(a/b);
}
catch (Exception e)
{
Console.WriteLine(e);
}
Console.WriteLine("Rest of the code.....");
Console.ReadLine();
}
}
Output:
30
ANKIT TYAGI; ROLL NO 8990
31
ANKIT TYAGI; ROLL NO 8990
PRACTICAL 3
WORKING WITH WEB FORMS AND CONTROL
32
ANKIT TYAGI; ROLL NO 8990
3A] Create a simple web page with various server controls to demonstrate setting
and use of their properties. (Example: AutoPostBack)
Code:
Pra3A.aspx
33
ANKIT TYAGI; ROLL NO 8990
</asp:DropDownList>
<br />
<br />
select division:
<asp:ListBox ID="ListBox1" runat="server" AutoPostBack="True" Height="39px"
onselectedindexchanged="ListBox1_SelectedIndexChanged">
<asp:ListItem>A</asp:ListItem>
<asp:ListItem>B</asp:ListItem>
</asp:ListBox>
<br />
Name ::<asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>
<br />
Hobbies:<asp:Label ID="Label3" runat="server" Text="Label"></asp:Label>
<br />
Gender:<asp:Label ID="Label6" runat="server" Text="Label"></asp:Label>
<br />
Class:<asp:Label ID="Label4" runat="server" Text="Label"></asp:Label>
<br />
Division:<asp:TextBox ID="TextBox2" runat="server" Height="54px" Width="126px"></asp:TextBox>
<br />
<br />
</div>
</form>
</body>
</html>
Pra3A.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace practical3
{
public partial class pra3A : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
String name="Helloworld";
if(ViewState["name"]==null)
{
ViewState["name"]=name;
}
}
protected void Button1_Click(object sender, EventArgs e)
{
Label1.Text = ViewState["name"].ToString();
}
protected void TextBox1_TextChanged(object sender, EventArgs e)
{
Label2.Text = TextBox1.Text;
}
protected void CheckBox2_CheckedChanged(object sender, EventArgs e)
{
Label3.Text = CheckBox2.Text;
}
34
ANKIT TYAGI; ROLL NO 8990
Output:
35
ANKIT TYAGI; ROLL NO 8990
Code:
36
ANKIT TYAGI; ROLL NO 8990
</div>
</form>
</body>
</html>
Pra3b.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace practical3
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
Calendar1.Caption = "mycalender";
Calendar1.FirstDayOfWeek = FirstDayOfWeek.Sunday;
Calendar1.NextPrevFormat = NextPrevFormat.ShortMonth;
Calendar1.TitleFormat = TitleFormat.Month;
Label1.Text = Calendar1.SelectedDate.Date.ToString();
Label2.Text = Calendar1.TodaysDate.ToShortDateString();
Label3.Text = "9-10-2021";
TimeSpan d = new DateTime(2020, 9, 10) - DateTime.Now;
Label4.Text = d.Days.ToString();
TimeSpan d1 = new DateTime(2021, 12, 31) - DateTime.Now;
Label5.Text = d1.Days.ToString();
if (Calendar1.SelectedDate.ToShortDateString() == "9-10-2020")
Label3.Text = "<b>Ganpati festival start<b>";
if (Calendar1.SelectedDate.ToShortDateString() == "9-14-2020")
Label3.Text="<b>Ganpati festival end<b>";
}
protected void Calender1_DayRender(object sender,
System.Web.UI.WebControls.DayRenderEventArgs e)
{
if (e.Day.Date.Day == 15 && e.Day.Date.Month == 8)
{
e.Cell.BackColor = System.Drawing.Color.Thistle;
e.Cell.Text = "Independence day";
}
if (e.Day.Date.Day == 10 && e.Day.Date.Month == 9)
{
Calendar1.SelectedDate = new DateTime(2021, 9, 10);
Calendar1.SelectedDates.SelectRange(Calendar1.SelectedDate,Calendar1.SelectedDate.AddDa ys(10));
e.Cell.Text = "Ganpati";
}
}
}
}
37
ANKIT TYAGI; ROLL NO 8990
Output:
38
ANKIT TYAGI; ROLL NO 8990
PRACTICAL NO: 4
DEMONSTRATE THE USE OF TREE VIEW CONTROL PERFORMS
FOLLOWING OPERATIONS.
39
ANKIT TYAGI; ROLL NO 8990
Code:
Output:
ii.
iii.
40
ANKIT TYAGI; ROLL NO 8990
PRACTICAL NO: 5
WORKING WITH FORM CONTROLS
41
ANKIT TYAGI; ROLL NO 8990
Registration Form.aspx:
<%@Page Language="C#"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1"runat="server">
<asp:Label ID="Label1"runat="server" Text="Full Name :"></asp:Label>
<asp:TextBox ID="TextBox1"runat="server"
style="position: relative; top: 1px; left: 2px; width: 161px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1"runat="server"
ControlToValidate="TextBox1"ErrorMessage="Name cannot be blank."
ForeColor="Red"></asp:RequiredFieldValidator>
<br />
<br />
<asp:Label ID="Label2"runat="server" Text="E-Mail :"></asp:Label>
<asp:TextBox ID="TextBox2"runat="server" style="margin-left: 56px"
Width="145px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2"runat="server"
ControlToValidate="TextBox2"ErrorMessage="EMail cannot be blank."
ForeColor="Red"></asp:RequiredFieldValidator>
<br />
<br />
<asp:Label ID="Label3"runat="server" Text="DOB : "></asp:Label>
<asp:TextBox ID="TextBox3"runat="server" style="margin-left: 62px"
Width="141px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3"runat="server"
ControlToValidate="TextBox3"ErrorMessage="DOB cannot be blank."
ForeColor="Red"></asp:RequiredFieldValidator>
<br />
<br />
<asp:Label ID="Label4"runat="server" Text="Age : "></asp:Label>
<asp:TextBox ID="TextBox4"runat="server" style="margin-left: 72px"
Width="148px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator4"runat="server"
ControlToValidate="TextBox4"ErrorMessage="Age cannot be blank."
ForeColor="#FF5050"></asp:RequiredFieldValidator>
<asp:RangeValidator ID="RangeValidator1"runat="server"
42
ANKIT TYAGI; ROLL NO 8990
ControlToValidate="TextBox4"CultureInvariantValues="True"
ErrorMessage="Age must be between 18 - 30"ForeColor="#FF5050"
MaximumValue="30"MinimumValue="18"></asp:RangeValidator>
<br />
<br />
<asp:Label ID="Label7"runat="server" Text="Mobile No : "></asp:Label>
<asp:TextBox ID="TextBox7"runat="server" style="margin-left: 32px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator5"runat="server"
ControlToValidate="TextBox5"ErrorMessage="Mobile No cannot be blank."
ForeColor="Red"></asp:RequiredFieldValidator>
<br />
<br />
<asp:Label ID="Label5"runat="server" Text="Course :"></asp:Label>
<asp:TextBox ID="TextBox5"runat="server" style="margin-left: 57px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator6"runat="server"
ControlToValidate="TextBox6"ErrorMessage="Course cannot be blank."
ForeColor="Red"></asp:RequiredFieldValidator>
<br />
<br />
<asp:Label ID="Label6"runat="server" Text="Sem : "></asp:Label>
<asp:TextBox ID="TextBox6"runat="server"
style="margin-left: 70px; margin-top: 0px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator7"runat="server"
ControlToValidate="TextBox7"ErrorMessage="Sem cannot be blank."
ForeColor="Red"></asp:RequiredFieldValidator>
<br />
<br />
<asp:Button ID="Button1"runat="server" style="margin-left: 80px"
Text="SUBMIT" />
<asp:ValidationSummary ID="ValidationSummary1"runat="server" />
</form>
</body>
</html>
Default.Aspx.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default :System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
43
ANKIT TYAGI; ROLL NO 8990
Output:
44
ANKIT TYAGI; ROLL NO 8990
Code:
Default2.aspx
<%@ Page Language="C#"AutoEventWireup="true"CodeFile="Default2.aspx.cs"
Inherits="Default2"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1"runat="server">
<div>
</div>
</form>
</body>
</html>
ads.xml
<?xml version="1.0" encoding="utf-8" ?>
<Advertisements>
<Ad>
<ImageUrl>a.jpg</ImageUrl>
<Height>300px</Height>
<Width>200px</Width>
<NavigateUrl>https://www.google.co.in</NavigateUrl>
<AlternateText>abc site</AlternateText>
<Impressions>2</Impressions>
<Keyword>Computer</Keyword>
</Ad>
<Ad>
45
ANKIT TYAGI; ROLL NO 8990
<ImageUrl>b.jpg</ImageUrl>
<Height>300px</Height>
<Width>200px</Width>
<NavigateUrl>https://www.google.co.in</NavigateUrl>
<AlternateText>abc site</AlternateText>
<Impressions>2</Impressions>
<Keyword>Computer</Keyword>
</Ad>
</Advertisements>
Default2.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web; using System.Web.UI;
using System.Web.UI.WebControls;
}
}
Output:
46
ANKIT TYAGI; ROLL NO 8990
Default.aspx
<%@ Page
Language="C#"AutoEventWireup="true"CodeFile="Default.aspx.cs"Inherits="_Default"%>
<%@ Register Src="contactus.ascx"TagPrefix="uc1"TagName="contactus"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
<head runat="server">
<title></title>
</head>
<body>
<form id="form1"runat="server">
<div>
<uc1:contactusrunat="server" id="contactus"/>
</div>
</form>
</body>
</html>
User Control:
contactus.ascx
<%@ Control Language="C#"AutoEventWireup="true"CodeFile="contactus.ascx.cs"
Inherits="contactus"%>
<asp:Label ID="Label1"runat="server" Text="ENTER FIRST NAME"></asp:Label>
<asp:TextBox ID="TextBox1"runat="server"
style="position: relative; top: 0px; left: 28px; width: 130px"></asp:TextBox>
<p>
<asp:Label ID="Label2"runat="server" Text="ENTER LAST NAME"></asp:Label>
<asp:TextBox ID="TextBox2"runat="server" style="margin-left: 30px"></asp:TextBox>
</p>
<p>
<asp:Button ID="Button1"runat="server" style="margin-left:
85px" Text="SUBMIT" />
</p>
Output:
47
ANKIT TYAGI; ROLL NO 8990
48
ANKIT TYAGI; ROLL NO 8990
PRACTICAL NO: 6
WORKING WITH NAVIGATION, BEAUTIFICATION AND MASTER
PAGE.
49
ANKIT TYAGI; ROLL NO 8990
6A] Create Web Form to demonstrate use of Website Navigation controls and
Site Map.
Code:
Default.aspx
<%@ Page
Language="C#"AutoEventWireup="true"CodeBehind="Default.as
px.cs" Inherits="WebApplication15.WebForm1"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1"runat="server">
<asp:SiteMapPath ID="SiteMapPath1"runat="server">
</asp:SiteMapPath>
<div>
</div>
<asp:HyperLink ID="HyperLink1"runat="server"NavigateUrl="~/myweb1.aspx">HOME
PAGE</asp:HyperLink>
</form>
</body>
</html>
myweb1.aspx
50
ANKIT TYAGI; ROLL NO 8990
myweb2.aspx
<%@ Page Language="C#"AutoEventWireup="true"CodeBehind="myweb2.aspx.cs"
Inherits="WebApplication15.myweb2"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1- transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
51
ANKIT TYAGI; ROLL NO 8990
<title></title>
</head>
<body>
<form id="form1"runat="server">
<asp:SiteMapPath ID="SiteMapPath1"runat="server">
</asp:SiteMapPath>
<br />
<div>
<asp:HyperLink ID="HyperLink1"runat="server"NavigateUrl="~/myweb3.aspx">THIRD
PAGE</asp:HyperLink>
</div>
</form>
</body>
</html>
myweb3.aspx
<%@ Page Language="C#"AutoEventWireup="true"CodeBehind="myweb3.aspx.cs"
Inherits="WebApplication15.myweb3"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1"runat="server">
<asp:SiteMapPath ID="SiteMapPath1"runat="server">
</asp:SiteMapPath>
<br />
<div>
<asp:HyperLink ID="HyperLink1"runat="server"NavigateUrl="~/Default.aspx">HOME
PAGE</asp:HyperLink>
</div>
</form>
</body>
</html>
OUTPUT:
52
ANKIT TYAGI; ROLL NO 8990
1. Home page:
2. First Page:
3. Second Page:
4. Third Page:
53
ANKIT TYAGI; ROLL NO 8990
6B] Create a web application to demonstrate the use of Master Page with applying
Styles and Themes for page beautification.
Code:
Site1.master
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">Vodafone Mobile Store</p>
<title>Vodafone Mobile Store</title>
<asp:ContentPlaceHolder id="head"runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<link rel="Stylesheet"href="StyleSheet.css" type="text/css" />
<form id="form1"runat="server">
<div>
<asp:ContentPlaceHolder id="ContentPlaceHolder1"runat="server">
<p>
<p>
<p>
<p>
<p>
<p>
<p>
</asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>
54
ANKIT TYAGI; ROLL NO 8990
Default.aspx
<%@ Page Title=""
Language="C#"MasterPageFile="~/site1.master"AutoEventWireup="true"CodeFile="Default.as
px.cs" Inherits="_Default" %>
<asp:Content ID="c2"ContentPlaceHolderID="ContentPlaceHolder1"Runat="Server">
<asp:Label ID="Label1"runat="server" Text="Select The Date"></asp:Label>
<asp:Calendar ID="Calendar1"runat="server"></asp:Calendar>
<asp:HyperLink
ID="HyperLink1"runat="server"NavigateUrl="~/Default2.aspx">Next</asp:HyperLink
<p>
</p>
</asp:Content>
Default1.aspx
<asp:Content ID="c1"ContentPlaceHolderID="ContentPlaceHolder1"Runat="Server">
<asp:Label ID="Label1"runat="server" style="position: relative" Text="NAME"></asp:Label>
<asp:TextBox ID="TextBox1"runat="server" style="margin-left: 24px"
Width="133px"></asp:TextBox>
<asp:HyperLink ID="HyperLink1"runat="server"NavigateUrl="~/Default.aspx"
style="position: relative">HOME PAGE</asp:HyperLink>
</asp:Content>
Stylesheet.cs
body
{
background-color:White;
font:italic|Arial|12;
}
Skin Code
Theme.skin
<%--
Default skin template. The following skins are provided as examples only.
55
ANKIT TYAGI; ROLL NO 8990
<asp:GridViewrunat="server"SkinId="gridviewSkin"BackColor="White">
<AlternatingRowStyleBackColor="Blue" />
</asp:GridView>
<asp:Imagerunat="server"ImageUrl="~/images/image1.jpg" />
--%>
<asp:Labelrunat="server"backcolor=blue/>
Output:
56
ANKIT TYAGI; ROLL NO 8990
A] WebForm1.aspx
WebForm1.aspx.cs
using System;
using
System.Collections.Generic;
using System.Linq;
using
System.Web;
using
System.Web.UI;
using System.Web.UI.WebControls;
namespace WebApplication11
{
public partial class WebForm1 :System.Web.UI.Page
{
public string a, b;
protected void Button1_Click(object sender, EventArgs e)
57
ANKIT TYAGI; ROLL NO 8990
ViewState["name"] =
TextBox1.Text;
ViewState["password"] =
TextBox2.Text;
if (ViewState["name"] != null)
{
TextBox1.Text = ViewState["name"].ToString();
}
if (ViewState["password"] != null)
{
TextBox2.Text = ViewState["password"].ToString();
}
}
}
}
Default.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1"runat="server">
<title>
Untitled Page
</title>
</head>
58
ANKIT TYAGI; ROLL NO 8990
<body>
<form id="form1"runat="server">
<div>
<tr>
<td style="width: 209px">
<asp:Label ID="lblstr"runat="server" Text="Enter a String" style="width:94px">
</asp:Label>
</td>
<tr>
<td style="width: 209px"></td>
<td style="width: 317px"></td>
</tr>
<tr>
<td style="width: 209px">
<asp:Button ID="btnnrm"runat="server"
Text="No action button" style="width:128px" />
</td>
<tr>
<td style="width: 209px"></td>
<tr>
<td style="width: 209px">
59
ANKIT TYAGI; ROLL NO 8990
<tr>
<td style="width: 209px">
<asp:Label ID="lblshstr"runat="server">
</asp:Label>
</td>
</table>
</div>
</form>
</body>
</html>
Default.aspx.cs
using System;
using System.Collections.Generic;
using
System.Linq;
using
System.Web;
using
System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default :System.Web.UI.Page
{
String mystr;
60
ANKIT TYAGI; ROLL NO 8990
}
}
Output:
61
ANKIT TYAGI; ROLL NO 8990
PRACTICAL NO: 7
WORKING WITH DATABASE
62
ANKIT TYAGI; ROLL NO 8990
7A] Create a web application for inserting and deleting records from a
database.
Code:
Default.asp
<%@PageLanguage="C#"AutoEventWireup="true"CodeFile="Default.aspx.cs"Inherits="_Defa
ult"%>
<htmlxmlns="http://www.w3.org/1999/xhtml">
<headrunat="server">
<title></title>
</head>
<body>
<formid="form1"runat="server">
<div>
<asp:LabelID="Label1"runat="server"Text="Roll No"></asp:Label>
<asp:TextBoxID="TextBox1"runat="server"
style="position: relative; top: -2px; left: 73px; width: 129px"></asp:TextBox>
</div><p>
<asp:LabelID="Label2"runat="server"Text="Name"></asp:Label>
<asp:TextBoxID="TextBox2"runat="server"style="margin-left: 83px"></asp:TextBox></p>
<asp:LabelID="Label3"runat="server"Text="Mobile Number"></asp:Label>
<asp:TextBoxID="TextBox3"runat="server"style="margin-left: 24px"></asp:TextBox><p>
<asp:ButtonID="Button1"runat="server"onclick="Button1_Click"style="margin-
left:
138px"Text="INSERT"Width="68px"/><asp:ButtonID="Button2"runat="server"
onclick="Button2_Click"style="position: relative; top: 0px; left: 25px; width:
78px"
Text="UPDATE"/>
<asp:ButtonID="Button3"runat="server"onclick="Button3_Click"Text="Delete"style="m
argin-left: 65px"Width="105px"/>
</p>
<asp:GridViewID="GridView1"runat="server">
</asp:GridView>
</form>
</body></html
>Aspx.cs Code:
63
ANKIT TYAGI; ROLL NO 8990
Default.aspx.csusing System;
usingSystem.Collections.Generic;
usingSystem.Linq;
usingSystem.Web;
usingSystem.Web.UI;
usingSystem.Web.UI.WebControls;
usingSystem.Data.SqlClient;
publicpartialclass_Default : System.Web.UI.Page
{
GridView1.DataSource =cmd.ExecuteReader();
GridView1.DataBind();
con.Close();
con.Open();
cmd.ExecuteNonQuery();
con.Close();
Response.Redirect("Default.aspx");
64
ANKIT TYAGI; ROLL NO 8990
con.Open();
Response.Redirect("Default.aspx");
}
protectedvoid Button3_Click(object sender, EventArgs e)
con.Open();
con.Close();
Response.Redirect("Default.aspx");
65
ANKIT TYAGI; ROLL NO 8990
Output:
Original Database:
Inserting Values:
66
ANKIT TYAGI; ROLL NO 8990
67
ANKIT TYAGI; ROLL NO 8990
Code:
Default.aspx
<%@PageLanguage="C#"AutoEventWireup="true"CodeFile="Default.aspx.cs"Inherits="_Defa
ult"%>
<htmlxmlns="http://www.w3.org/1999/xhtml">
<headrunat="server">
<title></title>
</head>
<body>
<formid="form1"runat="server">
<div>
<asp:LabelID="Label1"runat="server"Text="Roll No"></asp:Label>
<asp:TextBoxID="TextBox1"runat="server"
style="position: relative; top: -2px; left: 73px; width: 129px"></asp:TextBox>
</div><p>
<asp:LabelID="Label2"runat="server"Text="Name"></asp:Label>
<asp:TextBoxID="TextBox2"runat="server"style="margin-left: 83px"></asp:TextBox></p>
<asp:LabelID="Label3"runat="server"Text="Mobile Number"></asp:Label>
<asp:TextBoxID="TextBox3"runat="server"style="margin-left: 24px"></asp:TextBox><p>
<asp:ButtonID="Button1"runat="server"onclick="Button1_Click"style="margin-
left:
138px"Text="INSERT"Width="68px"/><asp:ButtonID="Button2"runat="server"
onclick="Button2_Click"style="position: relative; top: 0px; left: 25px; width:
78px"
Text="UPDATE"/>
<asp:ButtonID="Button3"runat="server"onclick="Button3_Click"Text="Delete"style="m
argin-left: 65px"Width="105px"/>
68
ANKIT TYAGI; ROLL NO 8990
</p>
<asp:GridViewID="GridView1"runat="server">
</asp:GridView>
</form>
</body>
</html>
Aspx.cs
Default.aspx.csusing System;
usingSystem.Collections.Generic;
usingSystem.Linq;
usingSystem.Web;
usingSystem.Web.UI;
usingSystem.Web.UI.WebControls;
usingSystem.Data.SqlClient;
publicpartialclass_Default : System.Web.UI.Page
{
}
protectedvoid Button1_Click(object sender, EventArgs e)
{
con.Open();
cmd.ExecuteNonQuery();
con.Close();
69
ANKIT TYAGI; ROLL NO 8990
Response.Redirect("Default.aspx");
}
con.Open();
con.Open();
Output:
Original Database:
70
ANKIT TYAGI; ROLL NO 8990
Inserting Values:
71
ANKIT TYAGI; ROLL NO 8990
PRACTICAL NO: 8
WORKING WITH DATABASE
72
ANKIT TYAGI; ROLL NO 8990
8A] Create a web application to display Data binding using dropdown list
control.
Code:
Default.aspx
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<title></title>
</head>
<body>
<div>
</div><p>
<br />
<br />
73
ANKIT TYAGI; ROLL NO 8990
<br />
<br />
<p>
Text="UPDATE" />
</p>
</asp:GridView>
</form>
</body>
</html>
Default2.aspx
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
74
ANKIT TYAGI; ROLL NO 8990
</head>
<body>
<div>
</asp:DropDownList>
<br />
<br />
<br />
<br />
BorderColor="#999999"
<AlternatingRowStyleBackColor="#DCDCDC" />
<SortedAscendingCellStyleBackColor="#F1F1F1" />
<SortedAscendingHeaderStyleBackColor="#0000A9" />
75
ANKIT TYAGI; ROLL NO 8990
<SortedDescendingCellStyleBackColor="#CAC9C9" />
<SortedDescendingHeaderStyleBackColor="#000065" />
</asp:GridView>
</div>
</form>
</body>
</html>
Aspx.cs Code:
Default.aspx.cs
usingSystem.Data.SqlClient;
Source=.\SQLEXPRESS;AttachDbFilename='C:\Users\SujuTadadikar\Documents\Visual
Timeout=30;User Instance=True");
GridView1.DataSource = cmd.ExecuteReader();
76
ANKIT TYAGI; ROLL NO 8990
GridView1.DataBind();
con.Close();
}
protected void Button1_Click(object sender, EventArgs e)
{
con.Open();
con.Close();
Response.Redirect("Default.aspx");
con.Open();
SqlCommandcmd = new SqlCommand("update student set s_name='" + TextBox2.Text +
"' where s_id=' " + TextBox1.Text + "'", con);
cmd.ExecuteNonQuery();
con.Close();
Response.Redirect("Default.aspx");
con.Open();
con.Close();
77
ANKIT TYAGI; ROLL NO 8990
Response.Redirect("Default.aspx");
Default2.aspx.cs
TADADIKAR\DOCUMENTS\VISUAL STUDIO
2010\WEBSITES\WEBSITE18\APP_DATA\DATABASE.MDF';Integrated
DropDownList1.DataSource = dt;
DropDownList1.DataBind();
DropDownList1.DataTextField = "s_name";
78
ANKIT TYAGI; ROLL NO 8990
DropDownList1.DataValueField = "s_id";
DropDownList1.DataBind();
Adpt.Fill(dt);
GridView1.DataSource = dt;
GridView1.DataBind();
Output:
Home Page:
79
ANKIT TYAGI; ROLL NO 8990
Dropdown Page:
80
ANKIT TYAGI; ROLL NO 8990
PRACTICAL NO: 9
WORKING WITH DATA CONTROLS
81
ANKIT TYAGI; ROLL NO 8990
Code:
Default.aspx
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<div>
</div>
82
ANKIT TYAGI; ROLL NO 8990
<p>
</p>
<p>
</p>
DataSourceID="SqlDataSource1">
<Columns>
<asp:BoundFieldDataField="emp_id" HeaderText="emp_id"
SortExpression="emp_id" />
<asp:BoundFieldDataField="emp_name" HeaderText="emp_name"
SortExpression="emp_name" />
<asp:BoundFieldDataField="salary" HeaderText="salary"
SortExpression="salary" />
</Columns>
</asp:GridView>
</form>
</body>
</html>
Database:
83
ANKIT TYAGI; ROLL NO 8990
84
ANKIT TYAGI; ROLL NO 8990
Output:
85
ANKIT TYAGI; ROLL NO 8990
9B] Create a web application to demonstrate data binding using Details View
and Form View Control.
Code:
Default.aspx
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<div>
</div>
<p>
</p>
86
ANKIT TYAGI; ROLL NO 8990
DataSourceID="SqlDataSource1">
<Columns>
<asp:BoundFieldDataField="emp_id" HeaderText="emp_id"
SortExpression="emp_id" />
<asp:BoundFieldDataField="emp_name" HeaderText="emp_name"
SortExpression="emp_name" />
<asp:BoundFieldDataField="salary" HeaderText="salary"
SortExpression="salary" />
</Columns>
</asp:GridView>
<p>
</p>
<EditItemTemplate>emp_id:
<br />
emp_name:
<br />
salary:
<asp:TextBox ID="salaryTextBox" runat="server" Text='<%# Bind("salary") %>' />
<br />
87
ANKIT TYAGI; ROLL NO 8990
</EditItemTemplate><InsertItemT
emplate>emp_id:
<asp:TextBox ID="emp_idTextBox" runat="server" Text='<%# Bind("emp_id") %>' />
<br />emp_name:
<br />
salary:
<asp:TextBox ID="salaryTextBox" runat="server" Text='<%# Bind("salary") %>' />
<br />
</InsertItemTemplate><Item
Template>emp_id:
<asp:Label ID="emp_idLabel" runat="server" Text='<%# Bind("emp_id") %>' />
<br />emp_name:
<br />
salary:
<asp:Label ID="salaryLabel" runat="server" Text='<%# Bind("salary") %>' />
<br />
88
ANKIT TYAGI; ROLL NO 8990
</ItemTemplate>
</asp:FormView>
<br />
<br />
<Fields>
<asp:BoundFieldDataField="emp_id" HeaderText="emp_id"
SortExpression="emp_id" />
<asp:BoundFieldDataField="emp_name" HeaderText="emp_name"
SortExpression="emp_name" />
<asp:BoundFieldDataField="salary" HeaderText="salary"
SortExpression="salary" />
</Fields>
</asp:DetailsView>
</form>
</body>
</html>
Output:
89
ANKIT TYAGI; ROLL NO 8990
9C] Create a web application to display Using Disconnected Data Access and
Data binding using Grid View.
Code:
Default.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<div>
<Columns>
<asp:TemplateField HeaderText="EmployeId">
<ItemTemplate>
</ItemTemplate>
<FooterTemplate>
</asp:TextBox>
90
ANKIT TYAGI; ROLL NO 8990
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Firstname">
<ItemTemplate>
</ItemTemplate>
<FooterTemplate>
</asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="LastName">
<ItemTemplate>
</ItemTemplate>
<FooterTemplate>
</asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Address">
<ItemTemplate>
91
ANKIT TYAGI; ROLL NO 8990
</ItemTemplate>
<FooterTemplate>
</asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="EmailId">
<ItemTemplate>
</ItemTemplate>
<FooterTemplate>
</asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Operation">
<FooterTemplate>
</FooterTemplate>
</asp:TemplateField>
</Columns>
92
ANKIT TYAGI; ROLL NO 8990
</asp:GridView>
</div>
</form>
</body>
</html>
Default.aspx
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;
SqlConnection con;
SqlCommand cmd;
SqlDataAdapter adap;
93
ANKIT TYAGI; ROLL NO 8990
DataTable dt;
SqlCommandBuilder cmbuild;
public _Default()
if (!IsPostBack)
FillGrid();
dt = new DataTable();
adap.Fill(dt);
gridInsert.DataSource = dt;
gridInsert.DataBind();
con.Open();
cmd.ExecuteNonQuery();
con.Close();
Output:
95
ANKIT TYAGI; ROLL NO 8990
PRACTICAL NO: 10
WORKING WITH GRIDVIEW CONTROL
96
ANKIT TYAGI; ROLL NO 8990
Code:
Default.aspx
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<div>
97
ANKIT TYAGI; ROLL NO 8990
</div>
<p>
</p>
AutoGenerateEditButton="True" AutoGenerateDeleteButton="True"
DataSourceID="SqlDataSource1">
<Columns>
<asp:HyperLinkFieldDataTextField="emp_id" DataNavigateUrlFields="emp_id"
DataNavigateUrlFormatString="~/Details.aspx?emp_id={0}"
<asp:TemplateFieldHeaderText="emp_name" >
<ItemTemplate>
<%#Eval("emp_name") %>
</ItemTemplate>
<EditItemTemplate>
</EditItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<p>
</p>
<br />
<br />
98
ANKIT TYAGI; ROLL NO 8990
</form>
</body>
</html>
Details.aspx
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
</div>
Page</asp:HyperLink>
</form>
</body>
</html>
99
ANKIT TYAGI; ROLL NO 8990
100
ANKIT TYAGI; ROLL NO 8990
aspx.cs
using System;
usingSystem.Collections.Generic;
usingSystem.Linq;
usingSystem.Web;
usingSystem.Web.UI;
usingSystem.Web.UI.WebControls;
usingSystem.Data;
publicpartialclass_Default : System.Web.UI.Page
{
if (!this.IsPostBack)
DataTabledt = newDataTable();
dt.Columns.AddRange(newDataColumn[3] { newDataColumn("emp_id"), new
GridView1.DataBind();
}}}
Output:
Grid_view.aspx:-
Grid_view.aspx.cs:-
using System;
usingSystem.Collections.Generic;
usingSystem.Linq;
usingSystem.Web;
usingSystem.Web.UI;
usingSystem.Web.UI.WebControls;
usingSystem.Drawing;
public partial class grid_view : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void GridView1_RowCommand(object sender,
GridViewCommandEventArgs e)
{
if (e.CommandName == "b1")
{
Response.Write(e.CommandName);
GridView1.SelectedRowStyle.BackColor=System.Drawing.Color.Brown;
GridView1.Rows[Convert.ToInt16(e.CommandArgument)].BackColor =
System.Drawing.Color.Blue;
}
}
}
102
ANKIT TYAGI; ROLL NO 8990
Output:
103
ANKIT TYAGI; ROLL NO 8990
Code:
Default.aspx
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<div>
</div>
<Columns>
104
ANKIT TYAGI; ROLL NO 8990
<asp:BoundFieldDataField="emp_id" HeaderText="emp_id"
SortExpression="emp_id" />
<asp:BoundFieldDataField="emp_name" HeaderText="emp_name"
SortExpression="emp_name" />
<asp:BoundFieldDataField="salaray" HeaderText="salaray"
SortExpression="salaray" />
</Columns>
</asp:GridView>
</form>
</body></html>
ASPX.cs CODE:
Default.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.Data.SqlClient;
usingSystem.Data;
105
ANKIT TYAGI; ROLL NO 8990
BindData();
GridView1.DataBind();
GridView1.PageIndex = e.NewPageIndex;
BindData();
Design:
106
ANKIT TYAGI; ROLL NO 8990
Database:
Output:
107
ANKIT TYAGI; ROLL NO 8990
108
ANKIT TYAGI; ROLL NO 8990
PRACTICAL NO: 11
WORKING WITH AJAX AND XML AND JQUERY
109
ANKIT TYAGI; ROLL NO 8990
Code:
Webfor1.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div style="height: 362px; width: 937px">
<asp:Label ID="lbl1"
runat="server"></asp:Label>
<br />
<br />
<asp:Button ID="btnwrite" Text="XML writer" runat="server" Font-Size="X-Large"
onclick="btnwrite_Click"
/>
<br />
<br />
Width="239px"></asp:ListBox>
110
ANKIT TYAGI; ROLL NO 8990
</div>
</form>
</body>
</html>
Webform1.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.Xml;
namespace practical_10
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
111
ANKIT TYAGI; ROLL NO 8990
writer.WriteStartDocument();
writer.WriteComment("This is xml file for person details");
//write next element
writer.WriteStartElement("Details");
writer.WriteStartElement("p1");
writer.WriteAttributeString("id","1");
writer.WriteElementString("name","sona");
writer.WriteElementString("gender",
"female");
writer.WriteEndElement();
writer.WriteStartElement("p2");
writer.WriteAttributeString("id", "2");
writer.WriteElementString("name", "john");
writer.WriteElementString("gender", "male");
writer.WriteEndElement();
writer.WriteEndEleme
nt();
112
ANKIT TYAGI; ROLL NO 8990
{
XmlReader xReader = XmlReader.Create("c:\\users\\kiran\\documents\\visual
studio 2010\\Projects\\practical 10\\practical 10\\XMLFile1.xml");
while (xReader.Read())
{
switch (xReader.NodeType)
{
case XmlNodeType.Element:
ListBox1.Items.Add("<" + xReader.Name + ">");
break;
case XmlNodeType.Text:
ListBox1.Items.Add(xReader.Valu
e); break;
case XmlNodeType.EndElement:
ListBox1.Items.Add("</"+xReader.Name+"
>"); break;
}
}
}
}
}
Output-
Writing operation
113
ANKIT TYAGI; ROLL NO 8990
Reading operation:
114
ANKIT TYAGI; ROLL NO 8990
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>jquery selectors demo</title>
<script src="jquery-3.5.1.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
$("#btn1").click(function () {
$("#p1").hide("slow");
});
$("#btn2").click(function () {
$("#p1").show("slow");
});
$("p.c1").click(function () {
$("this").toggle();
});
115
ANKIT TYAGI; ROLL NO 8990
$("#btn4").click(function () {
$(".c1").slideUp();
});
$("#btn5").click(function () {
$("*").hide();
});
$("#btn3").click(function () {
$("div").animate({ left: '250px' });
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div style="background-color: #00FFFF; position: absolute;" >
<p id="p1">hide and show paragraph</p><br />
<p class="c1">click me to toggle paragraph</p><br />
<h2 class="c1">class selector</h2>
</div>
</form>
116
ANKIT TYAGI; ROLL NO 8990
</body>
</html>
Output:
117
ANKIT TYAGI; ROLL NO 8990
ajaxcontrol.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Ajaxcontrol.aspx.cs"
Inherits="WebApplication6.Ajaxcontrol" %>
<style type="text/css">
.style1
{
font-family: Arial;
}
.style2
{
font-size: x-large;
</style>
118
ANKIT TYAGI; ROLL NO 8990
<div>
<ProgressTemplate>
 
119
ANKIT TYAGI; ROLL NO 8990
<span>
class="style1"><strong> &nbs
p; <span class="style2"> Loading... </span>
</strong></span>
</ProgressTemplate>
</asp:UpdateProgress>
<ContentTemplate>
<br />
</asp:Timer>
<br />
<br />
</ContentTemplate>
</asp:UpdatePanel>
<p></p>
120
ANKIT TYAGI; ROLL NO 8990
<br />
<ProgressTemplate>
Loading...
</ProgressTemplate>
</asp:UpdateProgress>
</form>
</body>
</html>
ajaxcontrol.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
121
ANKIT TYAGI; ROLL NO 8990
namespace WebApplication6
System.Threading.Thread.Sleep(5000);
System.Threading.Thread.Sleep(5000);
122
ANKIT TYAGI; ROLL NO 8990
Output:
123
ANKIT TYAGI; ROLL NO 8990
124
ANKIT TYAGI; ROLL NO 8990
125