Awp Practical Manual-1
Awp Practical Manual-1
online
More Academy
ADVANCED WEB
PROGRAMMING
SEM : V
PRACTICAL MANUAL
namespace ConsoleApp10
{
internal class Program
{
static void Main(string[] args)
{
int no1, no2, no3, no4, ans;
Console.Write("First Number ");
no1 = int.Parse(Console.ReadLine());
Console.Write("Second Number ");
no2 = int.Parse(Console.ReadLine());
Console.Write("Third Number ");
no3 = int.Parse(Console.ReadLine());
Console.Write("Fourth Number ");
no4 = int.Parse(Console.ReadLine());
ans = no1 * no2 * no3 * no4;
Console.WriteLine("Product" + "" + ans);
Console.ReadKey();
}
}
}
Output:
Page 1 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
Practical 1b:
Create an application to demonstrate string operations.
Program.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp10
{
internal class Program
{
static void Main(string[] args)
{
Console.Write("Enter String ");
string s = Console.ReadLine();
Console.WriteLine(s.ToUpper());
Console.WriteLine(s.ToLower());
Console.WriteLine(s.Contains("More"));
Console.WriteLine(s.Length);
Console.WriteLine(s.TrimStart().Length);
Console.WriteLine(s.TrimEnd().Length);
Console.WriteLine(s.Trim().Length);
Console.ReadKey();
}
}
}
Output:
Page 2 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
Practical 1c:
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.
Program.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp10
{
internal class Program
{
struct Student
{
public int sid;
public string sname;
public string cname;
public int dd, mm, yy;
public void Display()
{
}
Page 3 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
Console.ReadKey();
}
}
}
}
Output:
Page 4 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
Practical 2a:
Create simple application to perform following operations.
Program.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Practical2A
{
class MyUtility
{
public int Fact(int x)
{
int f = 1;
for (int i = 2; i <= x; i++)
f = f * i;
return f;
}
public float DToR(float d)
{
return d * 79.66f;
}
public float RToD(float r)
{
return r / 79.66f;
}
public float CToF(float c)
{
return (c * 9) / 5 + 32;
}
}
internal class Program
{
static void Main(string[] args)
{
MyUtility m1 = new MyUtility();
Console.WriteLine("1. Factorial\n2. $ To inr \n3. inr To $ \n4. Celsius to Fahrenhieit ");
Console.Write("Enter Choice ");
int c = int.Parse(Console.ReadLine());
if(c == 1)
{
Console.Write("Enter Number ");
int no = int.Parse(Console.ReadLine());
int ans = m1.Fact(no);
Console.WriteLine("Factorial " + ans);
}
else if(c==2)
{
Console.Write("Enter $ amt ");
float d = float.Parse(Console.ReadLine());
Page 5 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
float ans=m1.DToR(d);
Console.WriteLine("INR " + ans);
}
else if(c==3)
{
Console.Write("Enter inr amt ");
float inr = float.Parse(Console.ReadLine());
float ans = m1.RToD(inr);
Console.WriteLine("$ " + ans);
}
else if(c==4)
{
Console.Write("Enter Celsius ");
float ce = float.Parse(Console.ReadLine());
float ans = m1.CToF(ce);
Console.WriteLine("Fahrenhieit value " + ans);
}
else
{
Console.WriteLine("Wrong Value");
}
Console.ReadKey();
}
}
}
Output:
Page 6 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
Practical 2b:
Page 7 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
b. Multi-Level Inheritance
Console.WriteLine("Grandfather...");
}
}
class Father : Grandfather
{
public void DisplayOne()
{
Console.WriteLine("Father...");
}
}
internal class Program
{
static void Main(string[] args)
{
c. Multi-Level Inheritance
class Shape
{
public void setWidth(int w)
{
width = w;
}
public void setHeight(int h)
{
height = h;
}
protected int width;
protected int height;
}
public interface PaintingCost
{
int getCost(int area);
}
class Rectangle : Shape, PaintingCost
{
public int getArea()
{
return (width * height);
}
{
return area * 80;
}
}
internal class Program
{
static void Main(string[] args)
{
d. Multi-Level Inheritance
class Father
{
public void display()
{
Console.WriteLine("Display...");
}
}
class Son : Father
{
public void displayOne()
{
Console.WriteLine("Display One");
}
}
class Daughter : Father
{
public void displayTwo()
{
Console.WriteLine("Display Two");
}
}
internal class Program
{
static void Main(string[] args)
{
Page 10 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
f.display();
Son s = new Son();
s.display();
s.displayOne();
Daughter d = new Daughter();
d.displayTwo();
Console.ReadKey();
}
}
Output:
Page 11 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
iv. Interfaces
interface IAnimal
{
void animalSound(); // interface method (does not have a body)
}
Page 12 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
Practical 2c:
Create simple application to demonstrate use of following concepts
i. Using Delegates and events
Program.cs
Output:
Page 13 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
Practical 3a:
Create a simple web page with various sever controls to demonstrate setting
and use of their properties. (Example : AutoPostBack)
WebForm1.aspx:
Create a web page with following design:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs"
Inherits="autopostback.WebForm1" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
Name :
<asp:TextBox ID="TextBox1" runat="server" AutoPostBack="True"
OnTextChanged="TextBox1_TextChanged"></asp:TextBox>
<asp:Label ID="Label2" runat="server"></asp:Label>
<br />
<br />
Course Name :
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"
OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">
<asp:ListItem Selected="True">Ty IT</asp:ListItem>
<asp:ListItem>Ty Com</asp:ListItem>
<asp:ListItem>BCA</asp:ListItem>
<asp:ListItem>Ty Arts</asp:ListItem>
</asp:DropDownList>
<asp:Label ID="Label3" runat="server"></asp:Label>
<br />
<br />
<br />
Select Language :
<asp:CheckBoxList ID="CheckBoxList1" runat="server" AutoPostBack="True"
OnSelectedIndexChanged="CheckBoxList1_SelectedIndexChanged" RepeatDirection="Horizontal">
<asp:ListItem>Python</asp:ListItem>
<asp:ListItem>C#</asp:ListItem>
<asp:ListItem>C++</asp:ListItem>
<asp:ListItem Selected="True">Java</asp:ListItem>
</asp:CheckBoxList>
<br />
<asp:Label ID="Label6" runat="server"></asp:Label>
<br />
<br />
Subjects :
<asp:ListBox ID="ListBox1" runat="server" AutoPostBack="True"
OnSelectedIndexChanged="ListBox1_SelectedIndexChanged" SelectionMode="Multiple">
<asp:ListItem>IOT</asp:ListItem>
<asp:ListItem>LINUX</asp:ListItem>
Page 14 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
<asp:ListItem Selected="True">AWP</asp:ListItem>
<asp:ListItem>JAVA</asp:ListItem>
</asp:ListBox>
<br />
<br />
<asp:Label ID="Label7" runat="server"></asp:Label>
<br />
<br />
<br />
Select Gender : <asp:RadioButtonList ID="RadioButtonList1" runat="server" AutoPostBack="True"
OnSelectedIndexChanged="RadioButtonList1_SelectedIndexChanged" RepeatDirection="Horizontal">
<asp:ListItem>Male</asp:ListItem>
<asp:ListItem>Female</asp:ListItem>
</asp:RadioButtonList>
<asp:Label ID="Label5" runat="server"></asp:Label>
<br />
<br />
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="SUBMIT" />
<br />
<br />
<asp:Label ID="Label1" runat="server"></asp:Label>
<br />
<br />
<asp:BulletedList ID="BulletedList1" runat="server" BulletStyle="Square">
<asp:ListItem>Fill the information correctly.</asp:ListItem>
<asp:ListItem>Select atleast 2 Languages.</asp:ListItem>
</asp:BulletedList>
<br />
<br />
<br />
<br />
<br />
</div>
</form>
</body>
</html>
Design View:
Page 15 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
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 autopostback
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Page 16 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
{
Label7.Text ="";
foreach (ListItem x in ListBox1.Items)
{
if (x.Selected)
{
Label7.Text +=x.Value;
}
}
}
}
}
Output:
Page 17 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
Practical 3b:
Demonstrate the use of Calendar control to perform following 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
WebForm1.aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs"
Inherits="practical3c.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:Calendar ID="Calendar1" runat="server" OnDayRender="Calendar1_DayRender"
OnSelectionChanged="Calendar1_SelectionChanged"></asp:Calendar>
<asp:Label ID="Label1" runat="server"></asp:Label>
<br />
<asp:Label ID="Label2" runat="server"></asp:Label>
<br />
<asp:Label ID="Label3" runat="server"></asp:Label>
<br />
<asp:Label ID="Label4" runat="server"></asp:Label>
<br />
<asp:Label ID="Label5" runat="server"></asp:Label>
<br />
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Submit" />
<asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="Reset" />
<br />
</div>
</form>
</body>
</html>
Page 18 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
Design View:
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 practical3c
{
public partial class WebForm2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
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 = "tg.jpg";
g1.Height = 20;
g1.Width = 20;
Page 19 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
e.Cell.Controls.Add(g1);
}
if (e.Day.Date.Day == 23 && e.Day.Date.Month == 10)
{
Calendar1.SelectedDate = new DateTime(2022, 10, 23);
Calendar1.SelectedDates.SelectRange(Calendar1.SelectedDate,
Calendar1.SelectedDate.AddDays(5));
Label lbl1 = new Label();
lbl1.Text = "<br>Diwali";
e.Cell.Controls.Add(lbl1);
}
}
}
Output:
Page 21 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
Practical 3c:
Demonstrate the use of Treeview control perform following operations.
a) Treeview control and datalist
b) Treeview operations
WebForm1.aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs"
Inherits="practical3c.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:TreeView ID="TreeView1" runat="server" Height="221px" ImageSet="WindowsHelp"
OnSelectedNodeChanged="TreeView1_SelectedNodeChanged" ShowLines="True" Width="211px">
<HoverNodeStyle Font-Underline="True" ForeColor="#6666AA" />
<Nodes>
<asp:TreeNode Text="Asp,Net Practicals" Value="Asp,Net Practicals">
<asp:TreeNode NavigateUrl="~/WebForm2.aspx" Text="Practical 3c" Value="Practical
3c"></asp:TreeNode>
</asp:TreeNode>
<asp:TreeNode Text="Java Practicals" Value="Java Practicals"></asp:TreeNode>
</Nodes>
<NodeStyle Font-Names="Tahoma" Font-Size="8pt" ForeColor="Black" HorizontalPadding="5px"
NodeSpacing="0px" VerticalPadding="1px" />
<ParentNodeStyle Font-Bold="False" />
<SelectedNodeStyle BackColor="#B5B5B5" Font-Underline="False" HorizontalPadding="0px"
VerticalPadding="0px" />
</asp:TreeView>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</div>
<asp:DataList ID="DataList1" runat="server" DataSourceID="XmlDataSource1">
<ItemTemplate>
sid:
<asp:Label ID="sidLabel" runat="server" Text='<%# Eval("sid") %>' />
<br />
sname:
<asp:Label ID="snameLabel" runat="server" Text='<%# Eval("sname") %>' />
<br />
age:
<asp:Label ID="ageLabel" runat="server" Text='<%# Eval("age") %>' />
<br />
<br />
</ItemTemplate>
</asp:DataList>
<asp:XmlDataSource ID="XmlDataSource1" runat="server"
DataFile="~/XMLFile2.xml"></asp:XmlDataSource>
Page 22 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
</form>
</body>
</html>
Design View:
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 practical3c
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
XMLFile1.xml:
<?xml version="1.0" encoding="utf-8" ?>
<students>
<student sid="1" sname="abc" age="20"></student>
<student sid="2" sname="bbc" age="20"></student>
<student sid="3" sname="xyz" age="20"></student>
</students>
Output:
Page 24 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
Practical 4a:
Create a Registration form to demonstrate use of various Validation
controls.
Registration.aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Registration.aspx.cs"
Inherits="Practical4a.Registration" %>
<!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="Name"></asp:Label>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox1"
ErrorMessage="Plz. Provide Name">*</asp:RequiredFieldValidator>
<br />
<br />
Age<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<asp:RangeValidator ID="RangeValidator1" runat="server" ControlToValidate="TextBox2"
Display="Dynamic" ErrorMessage="Age Must be between 17 to 25" MaximumValue="25" MinimumValue="17"
Type="Integer"></asp:RangeValidator>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="TextBox2"
ErrorMessage="Plz. Provide Age">*</asp:RequiredFieldValidator>
<br />
<br />
<asp:Label ID="Label2" runat="server" Text="Family Income"></asp:Label>
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
<asp:CompareValidator ID="CompareValidator1" runat="server" ControlToValidate="TextBox3"
ErrorMessage="Must be above 100000" Operator="GreaterThan" Type="Currency"
ValueToCompare="100000"></asp:CompareValidator>
<asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" ControlToValidate="TextBox3"
ErrorMessage=" enter your Income">*</asp:RequiredFieldValidator>
<br />
<br />
<asp:Label ID="Label3" runat="server" Text="Password"></asp:Label>
<asp:TextBox ID="TextBox4" runat="server" TextMode="Password"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="TextBox4"
ErrorMessage="*"></asp:RequiredFieldValidator>
<asp:RequiredFieldValidator ID="RequiredFieldValidator8" runat="server" ControlToValidate="TextBox4"
ErrorMessage="Plz provide password">*</asp:RequiredFieldValidator>
<br />
<br />
<asp:Label ID="Label4" runat="server" Text="Re-Enter Password"></asp:Label>
<asp:TextBox ID="TextBox5" runat="server" TextMode="Password"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="TextBox5"
Display="Dynamic" ErrorMessage="*"></asp:RequiredFieldValidator>
Page 25 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
Design View:
Page 26 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
Registration.aspx.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace Practical4a
{
public partial class Registration : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Output:
Page 27 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
Page 28 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
Practical 4b
Create Web Form to demonstrate use of Adrotator Control.
WebForm1.aspx:
Create a web page with following design:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs"
Inherits="Practical4b.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:AdRotator ID="AdRotator1" runat="server" DataSourceID="XmlDataSource1" Height="300px"
Width="400px" />
<asp:XmlDataSource ID="XmlDataSource1" runat="server"
DataFile="~/XMLFile1.xml"></asp:XmlDataSource>
</div>
</form>
</body>
</html>
Design View:
Page 29 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
XMLFile1.xml:
<?xml version="1.0" encoding="utf-8" ?>
<Advertisements>
<Ad>
<ImageUrl>onlineshopping.jpg</ImageUrl>
<NavigateUrl>https://www.amazon.com</NavigateUrl>
<AlternateText>
Order gifts and more
</AlternateText>
<Impressions>20</Impressions>
<Keyword>gifts</Keyword>
</Ad>
<Ad>
<ImageUrl>bannerad.png</ImageUrl>
<NavigateUrl>https://www.flipkart.com</NavigateUrl>
<AlternateText>Fashion</AlternateText>
<Impressions>20</Impressions>
<Keyword>fashion</Keyword>
</Ad>
<Ad>
<ImageUrl>bannerad2.png</ImageUrl>
<NavigateUrl>https://www.yahoo.com</NavigateUrl>
<AlternateText>Send flowers to Russia</AlternateText>
<Impressions>20</Impressions>
<Keyword>russia</Keyword>
</Ad>
<Ad>
<ImageUrl>banner3.jpeg</ImageUrl>
<NavigateUrl>https://www.acuityeducare.com</NavigateUrl>
<AlternateText>Training Certification Placements</AlternateText>
<Impressions>50</Impressions>
<Keyword>Education</Keyword>
</Ad>
</Advertisements>
Page 30 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
Output:
Page 31 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
Prcatical 4c
Create Web Form to demonstrate use User Controls.
WebUserControl1.ascx:
Create a web page with following design:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="WebUserControl1.ascx.cs"
Inherits="Practical4c.WebUserControl1" %>
<asp:Label ID="Label1" runat="server" Text="User Name"></asp:Label>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<p>
<asp:Label ID="Label2" runat="server" Text="Password"></asp:Label>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
</p>
<p>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Sign In" />
</p>
<p>
<asp:Label ID="Label3" runat="server" Text="Label"></asp:Label>
</p>
Design View:
WebForm1.aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs"
Inherits="Practical4c.WebForm1" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<uc1:WebUserControl1 ID="WebUserControl11" runat="server" />
</div>
</form>
</body>
Page 32 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
</html>
Design View:
Output:
Page 33 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
Practical 5a:
Create Web Form to demonstrate use of Website Navigation controls and Site Map.
Home.aspx:
<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true"
CodeBehind="Home.aspx.cs" Inherits="practical5a.Home" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<p>
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/admin/admin.aspx">Admin</asp:HyperLink>
<asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl="~/staff/StaffHome.aspx">Staff</asp:HyperLink>
<asp:HyperLink ID="HyperLink3" runat="server"
NavigateUrl="~/students/StudentHome.aspx">Student</asp:HyperLink>
</p>
Design View:
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>
<siteMap>
<providers>
<remove name="MySqlSiteMapProvider" />
</providers>
Page 34 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
</siteMap>
<compilation debug="true" targetFramework="4.7" />
<httpRuntime targetFramework="4.7" />
</system.web>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs"
type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider,
Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default
/nowarn:1659;1699;1701" />
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb"
type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider,
Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008
/define:_MYTYPE=\"Web\" /optionInfer+" />
</compilers>
</system.codedom>
</configuration>
Web.Sitemap:
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="Home.aspx" title="Home" description="">
<siteMapNode url="admin/admin.aspx" title="Admin Home" description=""/>
<siteMapNode url="staff/StaffHome.aspx" title="Staff Home" description="">
<siteMapNode url="staff/addstudents.aspx" title="Add Student"/>
</siteMapNode>
<siteMapNode url="students/StudentHome.aspx" title="Student Home">
<siteMapNode url="students/exam.aspx" title="Exam">
<siteMapNode url="students/result.aspx" title="Result"/>
</siteMapNode>
</siteMapNode>
</siteMapNode>
</siteMap>
Site1. Master :
<!DOCTYPE html>
<html>
<head runat="server">
<title></title>
<asp:ContentPlaceHolder ID="head" runat="server">
Page 35 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Menu ID="Menu1" runat="server" DataSourceID="SiteMapDataSource1" Orientation="Horizontal">
</asp:Menu>
<br />
<br />
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
<asp:SiteMapPath ID="SiteMapPath1" runat="server" Font-Names="Verdana" Font-Size="0.8em"
PathSeparator=" : ">
<CurrentNodeStyle ForeColor="#333333" />
<NodeStyle Font-Bold="True" ForeColor="#666666" />
<PathSeparatorStyle Font-Bold="True" ForeColor="#1C5E55" />
<RootNodeStyle Font-Bold="True" ForeColor="#1C5E55" />
</asp:SiteMapPath>
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />
</form>
</body>
</html>
Design View:
Output:
Page 36 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
Page 37 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
Practical 5b:
Create a web application to demonstrate use of Master Page with applying
Styles and Themes for page beautification.
Styles and Themes:
WebForm1.aspx:
Create a web page with following design:
<%@ Page Language="C#" Theme="Theme1" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs"
Inherits="ThemesAndSkins.WebForm1" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h1>Welcome To Abhay More</h1>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</div>
</form>
</body>
</html>
Design View:
StyleSheet1.css:
body {
background-color:red
}
Page 38 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
h1 {
background-color:yellow
}
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.7" />
<httpRuntime targetFramework="4.7" />
<pages theme="Theme2"></pages>
</system.web>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs"
type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider,
Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default
/nowarn:1659;1699;1701" />
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb"
type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider,
Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008
/define:_MYTYPE=\"Web\" /optionInfer+" />
</compilers>
</system.codedom>
</configuration>
Output:
MasterPage:
Site1.Master:
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site1.master.cs" Inherits="Practical5b.Site1"
%>
<!DOCTYPE html>
<html>
<head>
<title>my layout</title>
<link rel="stylesheet" type="text/css" href="css/StyleSheet1.css">
Page 39 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
</head>
<body>
<header id="header">
<h1>Learn Programming </h1>
</header>
<nav id="nav">
<ul>
<li><a href="home.aspx">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Article</a></li>
<li><a href="#">Contact</a></li>
</ul>
</nav>
<aside id="side">
<h1>news</h1>
<a href="#"><p>creating html website</p></a>
<a href="#"><p>learn css</p></a>
<a href="#">learn c#</a>
</aside>
<div id="con">
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
<footer id="footer">
copyright @Abhay More
</footer>
</body>
</html>
Design View:
WebForm2.aspx:
<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs"
Inherits="Practical5b.WebForm2" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
Develop project by your own
</asp:Content>
Page 40 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
Design View:
StyleSheet1.css:
#header {
color: #247BA0;
text-align: center;
font-size: 20px;
}
#nav {
background-color: #FF1654;
padding: 5px;
}
ul {
list-style-type: none;
}
li a {
color: #F1FAEE;
font-size: 30px;
column-width: 5%;
}
li {
display: inline;
padding-left: 2px;
column-width: 20px;
}
a{
text-decoration: none;
margin-left: 20px
}
li a:hover {
background-color: #F3FFBD;
color: #FF1654;
padding: 1%;
}
#side {
Page 41 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
text-align: center;
float: right;
width: 15%;
padding-bottom: 79%;
background-color: #F1FAEE;
}
#article {
background-color: #EEF5DB;
padding: 10px;
padding-bottom: 75%;
}
#footer {
background-color: #C7EFCF;
text-align: center;
padding-bottom: 5%;
font-size: 20px;
}
#con {
border: double;
border-color: burlywood;
}
Output:
Page 42 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
Practical 5c:
Create a web application to demonstrate various states of ASP.NET Pages.
ViewState:
WebForm1.aspx:
Create a web page with following design:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs"
Inherits="ViewStatePractial.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:Calendar ID="Calendar1" runat="server" EnableViewState="True"></asp:Calendar>
</div>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
<br />
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</form>
</body>
</html>
Design View:
WebForm1.aspx.cs:
using System;
using System.Collections.Generic;
using System.Linq;
Page 43 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace ViewStatePractial
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Output:
Page 44 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
<!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="Button" />
</div>
<br />
<asp:Label ID="Label1" runat="server"></asp:Label>
</form>
</body>
</html>
Design View:
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 ViewStatePractial
{
public partial class WebForm3 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Session["mysx"] = x;
Label1.Text =Label1.Text+ "<br>Session " + x;
}
}
}
Global.asax.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.SessionState;
namespace ViewStatePractial
{
public class Global : System.Web.HttpApplication
{
}
}
}
Page 46 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
Output:
Page 47 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
Practical 6a:
Create a web application bind data in a multiline textbox by querying in
another textbox.
WebForm1.aspx:
Create a web page with following design:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs"
Inherits="Practicala.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:TextBox ID="TextBox1" runat="server" Height="57px" TextMode="MultiLine"
Width="251px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox1"
ErrorMessage="Plz. Provide Query"></asp:RequiredFieldValidator>
<br />
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Show Data" />
<br />
<br />
<asp:TextBox ID="TextBox2" runat="server" Height="88px" TextMode="MultiLine"
Width="387px"></asp:TextBox>
</div>
</form>
</body>
</html>
Design View:
WebForm1.aspx.cs:
using System;
Page 48 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
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.Web.Configuration;
namespace Practicala
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
TextBox2.Text = "";
//adding result in listbox
while(dr.Read())
{
String itemstr = "";
for(int i=0;i<dr.FieldCount;i++)
{
itemstr = itemstr + " "+dr[i].ToString();
}
TextBox2.Text = itemstr;
}
//close connection
con.Close();
}catch(Exception ex)
{
TextBox2.Text = "";
TextBox2.Text=ex.Message;
}
Page 49 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
}
}
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.7" />
<httpRuntime targetFramework="4.7" />
</system.web>
<connectionStrings>
<add name="c1" connectionString="Data Source=.\sqlexpress;Initial Catalog=BscIT;Integrated
Security=True"/>
</connectionStrings>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs"
type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider,
Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default
/nowarn:1659;1699;1701" />
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb"
type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider,
Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008
/define:_MYTYPE=\"Web\" /optionInfer+" />
</compilers>
</system.codedom>
<appSettings>
<add key="ValidationSettings:UnobtrusiveValidationMode" value="None" />
</appSettings>
</configuration>
Output:
Page 50 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
Practical 6b:
Create a web application to display records by using database.
WebForm1.aspx:
Create a web page with following design:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="_6b.WebForm1"
%>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<center>
<form id="form1" runat="server">
<div>
Customer details:<br />
<br />
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" style="height: 29px" Text="Display
Record" />
<br />
<br />
<asp:Label ID="Label1" runat="server"></asp:Label>
</div>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConflictDetection="CompareAllValues"
ConnectionString="<%$ConnectionStrings:BscITConnectionString %>"
DeleteCommand="DELETE FROM [customer] WHERE [Id] = @original_Id AND (([cname] = @original_cname)
OR ([cname] IS NULL AND @original_cname IS NULL)) AND (([cemail] = @original_cemail) OR ([cemail] IS
NULL AND @original_cemail IS NULL)) AND (([city] = @original_city) OR ([city] IS NULL AND @original_city
IS NULL)) AND (([state] = @original_state) OR ([state] IS NULL AND @original_state IS NULL))"
InsertCommand="INSERT INTO [customer] ([Id], [cname], [cemail], [city], [state]) VALUES (@Id, @cname,
@cemail, @city, @state)" OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT * FROM
[customer]" UpdateCommand="UPDATE [customer] SET [cname] = @cname, [cemail] = @cemail, [city] = @city,
[state] = @state WHERE [Id] = @original_Id AND (([cname] = @original_cname) OR ([cname] IS NULL AND
@original_cname IS NULL)) AND (([cemail] = @original_cemail) OR ([cemail] IS NULL AND @original_cemail
IS NULL)) AND (([city] = @original_city) OR ([city] IS NULL AND @original_city IS NULL)) AND (([state] =
@original_state) OR ([state] IS NULL AND @original_state IS NULL))">
<DeleteParameters>
<asp:Parameter Name="original_Id" Type="Int32" />
<asp:Parameter Name="original_cname" Type="String" />
<asp:Parameter Name="original_cemail" Type="String" />
<asp:Parameter Name="original_city" Type="String" />
<asp:Parameter Name="original_state" Type="String" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="Id" Type="Int32" />
<asp:Parameter Name="cname" Type="String" />
<asp:Parameter Name="cemail" Type="String" />
<asp:Parameter Name="city" Type="String" />
<asp:Parameter Name="state" Type="String" />
</InsertParameters>
<UpdateParameters>
Page 51 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
Design View:
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.Data;
using System.Data.SqlClient;
using System.Web.Configuration;
namespace _6b
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
catch (Exception ex)
{
Label1.Text = "Contact Admin " + ex.Message;
}
}
}
}
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>
<connectionStrings>
<add name="BscITConnectionString" connectionString="Data Source=LAPTOP-
VKNG3SD6\SQLEXPRESS;Initial Catalog=BscIT;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.7.2" />
<httpRuntime targetFramework="4.7.2" />
</system.web>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs"
type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider,
Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default
/nowarn:1659;1699;1701" />
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb"
type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider,
Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008
/define:_MYTYPE=\"Web\" /optionInfer+" />
Page 53 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
</compilers>
</system.codedom>
</configuration>
Output:
Page 54 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
Practical 6c
Demonstrate the use of Datalist link control.
Steps:
1. Drag the Datalist control to our web page form toolbox->Data->Datalist.
2. Then select Choose Data Source Option and select <New Data Source> .
Page 55 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
Test Connection:
Page 56 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
10. Once the Connection is made then click on Next button from Data Source Wizard.
11. Then wizard ask for saving the connection string in configuration file. If you already stored it web.config file then
uncheck check box, if you haven’t, then select the checkbook. Then click on next button.
12. The next screen gives option to configure the select statement. Here we can choose the table as well as configure
Page 57 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
13. In next screen we can test our query to check the output. Then Click on finish.
Page 58 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
WebForm1.aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs"
Inherits="Practical6c.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:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$
ConnectionStrings:BscITConnectionString %>" SelectCommand="SELECT * FROM
[customer]"></asp:SqlDataSource>
</div>
<asp:DataList ID="DataList1" runat="server" BackColor="LightGoldenrodYellow" BorderColor="Tan"
BorderWidth="1px" CellPadding="2" DataKeyField="Id" DataSourceID="SqlDataSource1" ForeColor="Black">
<AlternatingItemStyle BackColor="PaleGoldenrod" />
<FooterStyle BackColor="Tan" />
<HeaderStyle BackColor="Tan" Font-Bold="True" />
Page 59 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
<ItemTemplate>
Id:
<asp:Label ID="IdLabel" runat="server" Text='<%# Eval("Id") %>' />
<br />
cname:
<asp:Label ID="cnameLabel" runat="server" Text='<%# Eval("cname") %>' />
<br />
cemail:
<asp:Label ID="cemailLabel" runat="server" Text='<%# Eval("cemail") %>' />
<br />
city:
<asp:Label ID="cityLabel" runat="server" Text='<%# Eval("city") %>' />
<br />
state:
<asp:Label ID="stateLabel" runat="server" Text='<%# Eval("state") %>' />
<br /><br />
</ItemTemplate>
<SelectedItemStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" />
</asp:DataList>
</form>
</body>
</html>
Design View:
Page 60 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
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>
<connectionStrings>
<add name="BscITConnectionString" connectionString="Data Source=LAPTOP-
VKNG3SD6\SQLEXPRESS;Initial Catalog=BscIT;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.7.2" />
<httpRuntime targetFramework="4.7.2" />
</system.web>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs"
type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider,
Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default
/nowarn:1659;1699;1701" />
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb"
type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider,
Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008
/define:_MYTYPE=\"Web\" /optionInfer+" />
</compilers>
</system.codedom>
</configuration>
Output:
Page 61 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
Practical 7a:
Create a web application to display Databinding using dropdownlist control.
WebForm1.aspx:
Create a web page with following design:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs"
Inherits="Practical7a.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:DropDownList ID="DropDownList1" runat="server">
</asp:DropDownList>
<br />
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Show" />
<br />
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</div>
</form>
</body>
</html>
Design View:
Page 62 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
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.Data;
using System.Data.SqlClient;
using System.Web.Configuration;
namespace Practical7a
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostBack)
{
try
{
string constr = WebConfigurationManager.ConnectionStrings["c1"].ConnectionString;
SqlConnection con = new SqlConnection(constr);
con.Open();
SqlCommand cmd = new SqlCommand("select * from employee", con);
SqlDataReader dr = cmd.ExecuteReader();
DropDownList1.DataSource = dr;
DropDownList1.DataTextField = "Ename";
this.DataBind();
}catch(Exception ex)
{
Label1.Text = ex.Message;
}
}
}
Output:
Page 64 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
Practical 7b:
Create a web application for to display the phone no of an author using
database.
1. Create table in Microsoft SQL Server Management Studio.
WebForm1.aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs"
Inherits="Practical7b.WebForm1" %>
<!DOCTYPE html>
Page 65 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<asp:DropDownList ID="DropDownList1" runat="server">
</asp:DropDownList>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Show" />
<asp:Label ID="Label1" runat="server" Text=" "></asp:Label>
<div>
</div>
</form>
</body>
</html>
Design View:
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.Data;
using System.Data.SqlClient;
using System.Web.Configuration;
namespace Practical7b
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostBack)
{
try
{
SqlConnection con = new
SqlConnection(WebConfigurationManager.ConnectionStrings["c1"].ConnectionString);
con.Open();
SqlCommand cmd = new SqlCommand("select * from authors", con);
SqlDataReader dr = cmd.ExecuteReader();
Page 66 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
DropDownList1.DataSource = dr;
DropDownList1.DataTextField = "Auname";
DropDownList1.DataValueField = "phoneno";
DropDownList1.DataBind();
con.Close();
}catch(Exception ex)
{
Label1.Text = ex.Message;
}
}
}
Page 67 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
Practical 7c:
Create a web application for inserting and deleting record from a database.
(Using Execute-Non Query).
1. Create table in Microsoft SQL Server Management Studio.
WebForm1.aspx:
Create a web page with following design:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs"
Inherits="Practical7c.WebForm1" %>
<!DOCTYPE html>
Page 68 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
<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" Text="Add New Author" OnClick="Button1_Click" />
<asp:Button ID="Button2" runat="server" Text="Remove Author" OnClick="Button2_Click" />
<asp:MultiView ID="MultiView1" runat="server">
<asp:View ID="View1" runat="server">
<br />
<asp:Label ID="Label1" runat="server" Text="Author ID"></asp:Label>
<asp:TextBox ID="TextBox1" runat="server" TextMode="Number"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="TextBox1" ErrorMessage="*" ValidationGroup="a"></asp:RequiredFieldValidator>
<br />
<br />
<asp:Label ID="Label2" runat="server" Text="Author Name"></asp:Label>
<asp:TextBox ID="TextBox2" runat="server" MaxLength="50"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
ControlToValidate="TextBox2" ErrorMessage="*" ValidationGroup="a"></asp:RequiredFieldValidator>
<br />
<br />
<asp:Label ID="Label3" runat="server" Text="Author Phone Number"></asp:Label>
<asp:TextBox ID="TextBox3" runat="server" MaxLength="10"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server"
ControlToValidate="TextBox3" Display="Dynamic" ErrorMessage="*"
ValidationGroup="a"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server"
ControlToValidate="TextBox3" ErrorMessage="Invalid Number" ValidationExpression="\d{10}"
ValidationGroup="a"></asp:RegularExpressionValidator>
<br />
<br />
<asp:Button ID="Button3" runat="server" OnClick="Button3_Click" Text="Insert" ValidationGroup="a"
/>
<asp:Label ID="lblmessage" runat="server"></asp:Label>
</asp:View>
<asp:View ID="View2" runat="server">
<br />
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"
OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">
</asp:DropDownList>
<asp:Label ID="lblname" runat="server"></asp:Label>
<br />
<br />
<asp:Button ID="Button4" runat="server" OnClick="Button4_Click" Text="Delete" />
Page 69 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
</asp:View>
</asp:MultiView>
</div>
</form>
</body>
</html>
Design View:
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.Data;
using System.Data.SqlClient;
using System.Web.Configuration;
namespace Practical7c
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
{
MultiView1.SetActiveView(View1);
}
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.7" />
<httpRuntime targetFramework="4.7" />
</system.web>
<connectionStrings>
<add name="c1" connectionString="Data Source=.\sqlexpress;Initial Catalog=BscIT;Integrated
Security=True"/>
</connectionStrings>
<appSettings>
<add key="ValidationSettings:UnobtrusiveValidationMode" value="None" />
</appSettings>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs"
type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider,
Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default
/nowarn:1659;1699;1701" />
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb"
type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider,
Page 72 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
Page 73 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
Practical 8a:
Create a web application to demonstrate various uses and properties of
SqlDataSource.
WebForm1.aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs"
Inherits="Practical8a.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:Label ID="Label1" runat="server" Text="Employee ID"></asp:Label>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br />
<asp:Label ID="Label2" runat="server" Text="Employee Name"></asp:Label>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<br />
<asp:Label ID="Label3" runat="server" Text="Employee Salary"></asp:Label>
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
<br />
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Add" />
</div>
<asp:Label ID="Label4" runat="server"></asp:Label>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConflictDetection="CompareAllValues"
ConnectionString="<%$ ConnectionStrings:BscITConnectionString %>" DeleteCommand="DELETE FROM
[Employee] WHERE [Eid] = @original_Eid AND (([Ename] = @original_Ename) OR ([Ename] IS NULL AND
@original_Ename IS NULL)) AND [Esalary] = @original_Esalary" InsertCommand="INSERT INTO [Employee]
([Eid], [Ename], [Esalary]) VALUES (@Eid, @Ename, @Esalary)"
OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT * FROM [Employee]"
UpdateCommand="UPDATE [Employee] SET [Ename] = @Ename, [Esalary] = @Esalary WHERE [Eid] =
@original_Eid AND (([Ename] = @original_Ename) OR ([Ename] IS NULL AND @original_Ename IS NULL))
AND [Esalary] = @original_Esalary">
<DeleteParameters>
<asp:Parameter Name="original_Eid" Type="Int32" />
<asp:Parameter Name="original_Ename" Type="String" />
<asp:Parameter Name="original_Esalary" Type="Int32" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="Eid" Type="Int32" />
<asp:Parameter Name="Ename" Type="String" />
<asp:Parameter Name="Esalary" Type="Int32" />
</InsertParameters>
<UpdateParameters>
<asp:Parameter Name="Ename" Type="String" />
<asp:Parameter Name="Esalary" Type="Int32" />
<asp:Parameter Name="original_Eid" Type="Int32" />
<asp:Parameter Name="original_Ename" Type="String" />
<asp:Parameter Name="original_Esalary" Type="Int32" />
Page 74 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
</UpdateParameters>
</asp:SqlDataSource>
</form>
</body>
</html>
Design View:
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 Practical8a
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
SqlDataSource1.InsertParameters["eid"].DefaultValue = TextBox1.Text;
SqlDataSource1.InsertParameters["ename"].DefaultValue = TextBox2.Text;
SqlDataSource1.InsertParameters["esalary"].DefaultValue = TextBox3.Text;
SqlDataSource1.Insert();
Label4.Text = "Record is added successfully";
TextBox1.Text = "";
TextBox2.Text = "";
TextBox3.Text = "";
}
}
}
Output:
Page 75 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
Practical 8b:
Create a web application to demonstrate data binding using DetailsView
and FormView Control.
WebForm1.aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs"
Inherits="Practical8a.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:Label ID="Label1" runat="server" Text="Employee ID"></asp:Label>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br />
<asp:Label ID="Label2" runat="server" Text="Employee Name"></asp:Label>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<br />
<asp:Label ID="Label3" runat="server" Text="Employee Salary"></asp:Label>
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
<br />
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Add" />
</div>
<asp:Label ID="Label4" runat="server"></asp:Label>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConflictDetection="CompareAllValues"
ConnectionString="<%$ ConnectionStrings:BscITConnectionString %>" DeleteCommand="DELETE FROM
[Employee] WHERE [Eid] = @original_Eid AND (([Ename] = @original_Ename) OR ([Ename] IS NULL AND
@original_Ename IS NULL)) AND [Esalary] = @original_Esalary" InsertCommand="INSERT INTO [Employee]
([Eid], [Ename], [Esalary]) VALUES (@Eid, @Ename, @Esalary)"
OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT * FROM [Employee]"
UpdateCommand="UPDATE [Employee] SET [Ename] = @Ename, [Esalary] = @Esalary WHERE [Eid] =
@original_Eid AND (([Ename] = @original_Ename) OR ([Ename] IS NULL AND @original_Ename IS NULL))
AND [Esalary] = @original_Esalary">
<DeleteParameters>
<asp:Parameter Name="original_Eid" Type="Int32" />
<asp:Parameter Name="original_Ename" Type="String" />
<asp:Parameter Name="original_Esalary" Type="Int32" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="Eid" Type="Int32" />
<asp:Parameter Name="Ename" Type="String" />
<asp:Parameter Name="Esalary" Type="Int32" />
</InsertParameters>
<UpdateParameters>
<asp:Parameter Name="Ename" Type="String" />
<asp:Parameter Name="Esalary" Type="Int32" />
<asp:Parameter Name="original_Eid" Type="Int32" />
<asp:Parameter Name="original_Ename" Type="String" />
<asp:Parameter Name="original_Esalary" Type="Int32" />
Page 76 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
</UpdateParameters>
</asp:SqlDataSource>
</form>
</body>
</html>
Design View:
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 Practical8a
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
TextBox2.Text = "";
TextBox3.Text = "";
}
}
}
Output:
Page 78 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
Practical 8c:
Create a web application to display Using Disconnected Data Access and
Databinding using GridView.
WebForm1.aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs"
Inherits="Practical8c.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:Label ID="Label1" runat="server" Text="Employee Salary >"></asp:Label>
<asp:TextBox ID="TextBox1" runat="server" TextMode="Number"></asp:TextBox>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Show" />
</div>
<asp:GridView ID="GridView1" runat="server" BackColor="White" BorderColor="#CC9966"
BorderStyle="None" BorderWidth="1px" CellPadding="4">
<FooterStyle BackColor="#FFFFCC" ForeColor="#330099" />
<HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="#FFFFCC" />
<PagerStyle BackColor="#FFFFCC" ForeColor="#330099" HorizontalAlign="Center" />
<RowStyle BackColor="White" ForeColor="#330099" />
<SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="#663399" />
<SortedAscendingCellStyle BackColor="#FEFCEB" />
<SortedAscendingHeaderStyle BackColor="#AF0101" />
<SortedDescendingCellStyle BackColor="#F6F0C0" />
<SortedDescendingHeaderStyle BackColor="#7E0000" />
</asp:GridView>
</form>
</body>
</html>
Design View:
Page 79 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
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.Data;
using System.Data.SqlClient;
using System.Web.Configuration;
namespace Practical8c
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Output:
Page 80 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
Practical 9a:
Create a web application to demonstrate use of GridView button column
and GridView events.
1. Create table in Microsoft SQL Server Management Studio.
2. create table named employee in BSCIT database
3. add few records in it.
WebForm1.aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs"
Inherits="Practical9a1.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" AllowSorting="True" AutoGenerateColumns="False"
DataKeyNames="Eid" DataSourceID="SqlDataSource1" OnRowCommand="Test"
OnSelectedIndexChanged="GridView1_SelectedIndexChanged">
<Columns>
<asp:HyperLinkField DataNavigateUrlFields="Eid"
DataNavigateUrlFormatString="~/WebForm2.aspx?Empid={0}" DataTextField="Eid" DataTextFormatString="{0}"
HeaderText="Employee ID" NavigateUrl="~/WebForm2.aspx" />
<asp:BoundField DataField="Ename" HeaderText="Employee Name" SortExpression="Ename" />
<asp:BoundField DataField="Esalary" HeaderText="Employee Salary" SortExpression="Esalary" />
<asp:ButtonField ButtonType="Button" CommandName="A" Text="Button" />
</Columns>
<EmptyDataTemplate>
No Records Found
</EmptyDataTemplate>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$
ConnectionStrings:BscITConnectionString %>" SelectCommand="SELECT * FROM
[Employee]"></asp:SqlDataSource>
</div>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</form>
</body>
</html>
Page 81 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
Design View:
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 Practical9a1
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Page 82 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
Output:
WebForm2.aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs"
Inherits="Practical9a1.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:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" DataKeyNames="Eid"
DataSourceID="SqlDataSource1" Height="50px" Width="125px">
<Fields>
<asp:BoundField DataField="Eid" HeaderText="Eid" ReadOnly="True" SortExpression="Eid" />
<asp:BoundField DataField="Ename" HeaderText="Ename" SortExpression="Ename" />
<asp:BoundField DataField="Esalary" HeaderText="Esalary" SortExpression="Esalary" />
Page 83 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
</Fields>
</asp:DetailsView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$
ConnectionStrings:BscITConnectionString %>" SelectCommand="SELECT * FROM [Employee] WHERE ([Eid] =
@Eid)">
<SelectParameters>
<asp:QueryStringParameter Name="Eid" QueryStringField="Empid" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
</div>
</form>
</body>
</html>
Design View:
Page 84 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
Final Output:
After clicking on the hyperlink it will go to another page and display information of
that selected ID.
Page 85 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
Practical 9b:
Create a web application to demonstrate use of GridView button column
and GridView events.
WebForm1.aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs"
Inherits="Practical9b.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" AllowPaging="True" AutoGenerateColumns="False"
BackColor="#DEBA84" BorderColor="#DEBA84" BorderStyle="None" BorderWidth="1px" CellPadding="3"
CellSpacing="2" DataKeyNames="Eid" DataSourceID="SqlDataSource1" Height="217px"
OnRowCommand="GridView1_RowCommand" PageSize="3" Width="578px">
<Columns>
<asp:BoundField DataField="Eid" HeaderText="Employee ID" ReadOnly="True" SortExpression="Eid"
/>
<asp:BoundField DataField="Ename" HeaderText="Employee Name" SortExpression="Ename" />
<asp:BoundField DataField="Esalary" HeaderText="Employee Salary" SortExpression="Esalary"
DataFormatString="{0:c}" />
<asp:ButtonField ButtonType="Button" CommandName="Show" Text="Show Employee Name" />
</Columns>
<FooterStyle BackColor="#F7DFB5" ForeColor="#8C4510" />
<HeaderStyle BackColor="#A55129" Font-Bold="True" ForeColor="White" />
<PagerStyle ForeColor="#8C4510" HorizontalAlign="Center" />
<RowStyle BackColor="#FFF7E7" ForeColor="#8C4510" />
<SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="White" />
<SortedAscendingCellStyle BackColor="#FFF1D4" />
<SortedAscendingHeaderStyle BackColor="#B95C30" />
<SortedDescendingCellStyle BackColor="#F1E5CE" />
<SortedDescendingHeaderStyle BackColor="#93451F" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$
ConnectionStrings:BscITConnectionString %>" SelectCommand="SELECT * FROM
[Employee]"></asp:SqlDataSource>
</div>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</form>
</body>
</html>
Page 86 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
Design View:
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 Practical9b
Page 87 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Output:
Page 88 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
Practical 9c:
Create a web application to demonstrate GridView paging and Creating
own table format using GridView.
WebForm1.aspx:
<%@ 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" AllowPaging="True" AutoGenerateColumns="False"
CellPadding="4" DataKeyNames="Eid" DataSourceID="SqlDataSource1" ForeColor="#333333" GridLines="None"
Height="213px" PageSize="3" Width="343px">
<AlternatingRowStyle BackColor="White" />
<Columns>
<asp:BoundField DataField="Eid" HeaderText="Employee ID" ReadOnly="True" SortExpression="Eid"
/>
<asp:BoundField DataField="Ename" HeaderText="Employee Name" SortExpression="Ename" />
<asp:BoundField DataField="Esalary" DataFormatString="{0:c}" HeaderText="Employee Salary"
SortExpression="Esalary">
<HeaderStyle BackColor="#FF5050" ForeColor="#FFFFCC" />
</asp:BoundField>
</Columns>
<EditRowStyle BackColor="#2461BF" />
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<RowStyle BackColor="#EFF3FB" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<SortedAscendingCellStyle BackColor="#F5F7FB" />
<SortedAscendingHeaderStyle BackColor="#6D95E1" />
<SortedDescendingCellStyle BackColor="#E9EBEF" />
<SortedDescendingHeaderStyle BackColor="#4870BE" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$
ConnectionStrings:BscITConnectionString %>" SelectCommand="SELECT * FROM
[Employee]"></asp:SqlDataSource>
</div>
</form>
</body>
</html>
Page 89 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
Design View:
Enable paging
we can also set page size from properties
Output:
Page 90 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
Practical 10a:
Create a web application to demonstrate reading and writing operations
with XML.
Reading the content from XML file:
WebForm1.aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs"
Inherits="WebApplication31.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="Write XML" />
</div>
</form>
</body>
</html>
Design View:
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.IO;
using System.Xml;
namespace WebApplication31
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
FileStream fs = new FileStream("d:\\abhay.xml", FileMode.Create);
Page 91 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
writer.WriteStartElement("Students");
writer.WriteStartElement("student");
writer.WriteAttributeString("name", "abc");
writer.WriteAttributeString("age", "19");
writer.WriteEndElement();
writer.WriteStartElement("student");
writer.WriteAttributeString("name", "bbc");
writer.WriteAttributeString("age", "29");
writer.WriteEndElement();
writer.WriteEndElement();
writer.WriteEndDocument();
writer.Close();
fs.Close();
}
}
}
Writing operations with XML:
WebForm2.aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs"
Inherits="WebApplication31.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:GridView ID="GridView1" runat="server">
</asp:GridView>
</div>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Read And display on grid" />
<br />
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</form>
</body>
</html>
Design View:
Page 92 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
WebForm2.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.IO;
using System.Xml;
namespace WebApplication31
{
public partial class WebForm2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
XmlDataSource ds=new XmlDataSource();
ds.DataFile = "d:\\abhay.xml";
GridView1.DataSource = ds;
GridView1.DataBind();
Label1.Text = "";
XmlTextReader reader = new XmlTextReader("d:\\abhay.xml");
while(reader.Read())
{
Label1.Text += reader.GetAttribute("name");
Label1.Text += reader.GetAttribute("age");
Label1.Text += "<br>";
}
reader.Close();
}
}
}
Page 93 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
Output:
Practical 10b:
Page 94 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
Practical 10c:
Create a web application to demonstrate use of various Ajax controls.
WebForm1.aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs"
Inherits="WebApplication29.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:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
</div>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br />
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<br />
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
<br />
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</ContentTemplate>
</asp:UpdatePanel>
<br />
<asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1"
DisplayAfter="1500">
<ProgressTemplate>
plz. wait.....<br />
<asp:Image ID="Image1" runat="server" Height="60px" ImageUrl="~/loading.gif" Width="81px" />
</ProgressTemplate>
</asp:UpdateProgress>
<br />
<br />
<br />
<br />
<br />
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
<br />
<asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
<br />
<asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="Button" />
<br />
<asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>
Page 95 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
</form>
</body>
</html>
Design View:
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 WebApplication29
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Output:
Page 97 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
Practical 11:
1. Open Microsoft visual studio 2022.
2. Choose C#, Windows, Library.
3. Then choose Class Library -> Next
namespace TestLib
{
public class MathFunctions
{
public int Add(int x,int y)
{
return x + y;
}
public int fact(int x)
{
int f = 1;
for(int i=1;i<=x;i++)
{
f = f * i;
}
return f;
Page 98 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
}
}
}
WebForm1.aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs"
Inherits="WebApplication28.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:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</div>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
</form>
</body>
</html>
Design View:
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 TestLib;
namespace WebApplication28
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
MathFunctions m1 = new MathFunctions();
Page 99 of 100
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM – V AWP:MANUAL
Output: