Awp Manual

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 86

NAME:ROHIT GUPTA

CLASS: T.Y IT -B
ROLL NO:7266

PRACTICAL NO : 03

Working with Web forms and Controls


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

INPUT:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;

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

protected void Button1_Click(object sender, EventArgs e)


{
StringBuilder str = new StringBuilder();
if (Ch1.Checked)
str.Append(Ch1.Text + ",");
if (Ch2.Checked)
str.Append(Ch2.Text + ",");
if (Ch3.Checked)
str.Append(Ch3.Text);
Response.Write("Your Selection is "+ str.ToString());
}
}
}
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

OUTPUT:
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

B. 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
INPUT:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

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

protected void Calendar1_SelectionChanged(object sender, EventArgs e)


{
Response.Write("Your selected date is: ");
Response.Write(Calendar1.SelectedDate.ToShortDateString());
}

protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)


{
if (e.Day.IsOtherMonth && e.Day.Date.Day % 2 == 0)
{
e.Cell.BackColor = System.Drawing.Color.Black;
e.Cell.ForeColor = System.Drawing.Color.White;
e.Cell.Text = "X";
e.Cell.ToolTip = "Booked";
}
else
{
e.Cell.ToolTip = "Available";
}
}
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

OUTPUT:
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

C. Demonstrate the use of Treeview control perform following operations.


a) Treeview control and datalist b) Treeview operations
INPUT:
<?xml version="1.0" encoding="utf-8”?>
<items>
<treeviewitem text="Home" navigateurl="Default.aspx">
<treeviewitem text="Edit" navigateurl="Default.aspx">
<treeviewitem text="Cut" navigateurl="Default.aspx"/>
<treeviewitem text="Copy" navigateurl="Default.aspx"/>
</treeviewitem>

<treeviewitem text="File" navigateurl="Default.aspx">


<treeviewitem text="Save" navigateurl="Default.aspx"/>
</treeviewitem>

</treeviewitem>
</items>

OUTPUT:
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

PRACTICAL NO : 04
Working with Form Controls

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

Aspx code:

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>
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

<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"
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>
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

</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;

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


{
protected void Page_Load(object sender, EventArgs e)
{

}
}

DESIGN:
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

OUTPUT

B. Create Web Form to demonstrate use of Adrotator Control.

Aspx code:

Default2.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs"


Inherits="Default2" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

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

<asp:AdRotator ID="AdRotator1" runat="server" AdvertisementFile="~/ads.xml" />

</div>
</form>
</body>
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

</html>

XML CODE:

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>
<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>

Aspx.cs code:

Default2.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 Default2 : System.Web.UI.Page


{
protected void Page_Load(object sender, EventArgs e)
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

}
}
DESIGN:

OUTPUT:
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

C.Create Web Form to demonstrate use User Controls.

Aspx code:

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:contactus runat="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>
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

Design:

OUTPUT:
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

D. Create a form to demonstrate use of Custom Validation control.

Aspx code:

Default.aspx

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


Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/ecmascript">
function validateLength(sender, args) {
//debugger;
if (args.Value.length < 5) {
return args.IsValid = false;
}
else {
return args.IsValid = true;
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
Enter Password
<asp:TextBox ID="TextBox1" runat="server" TextMode="Password"></asp:TextBox>
</div>
<asp:CustomValidator ID="CustomValidator1" runat="server"
ClientValidationFunction="validateLength" ControlToValidate="TextBox1"
ErrorMessage="Password Should Greater than 5 character"></asp:CustomValidator>
<br />
<br />
Enter Password(server)<asp:TextBox ID="TextBox2" runat="server"
TextMode="Password"></asp:TextBox>
<p>
<asp:CustomValidator ID="CustomValidator2" runat="server"
ControlToValidate="TextBox2"
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

ErrorMessage="Server (Password should greater than 5 characters)"


style="position: relative" OnServerValidate="ServerValidate"></asp:CustomValidator>
</p>
<asp:Button ID="Button1" runat="server" Text="Validate" />
</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;

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


{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void ServerValidate(object source, ServerValidateEventArgs args)
{
if (args.Value.Length < 5)
{
args.IsValid = false;
}
else
{
args.IsValid = true;
}
}
}
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

OUTPUT:
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

PRACTICAL NO :05
a.Create Web Form to demonstrate use of Website Navigation controls and Site Map.

Web.sitmap Code:

<?xml version="1.0" encoding="utf-8" ?>


<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="" title="" description="">
<siteMapNode url="Default.aspx" title="HOME PAGE" description="" />
<siteMapNode url="myweb1.aspx" title="FIRST PAGE" description="" />
<siteMapNode url="myweb2.aspx" title="SECOND PAGE" description="" >
<siteMapNode url="myweb3.aspx" title="THIRD PAGE" description="" />
</siteMapNode>
</siteMapNode>
</siteMap>

Aspx code:

Default.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs"


Inherits="WebApplication15.WebForm1" %>

<!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">
<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>
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

myweb1.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="myweb1.aspx.cs"


Inherits="WebApplication15.myweb1" %>

<!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">
<asp:SiteMapPath ID="SiteMapPath1" runat="server">
</asp:SiteMapPath>
<br />
<div>

<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/myweb2.aspx">FIRST


PAGE</asp:HyperLink>

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

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">
<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>
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

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

myweb3.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="myweb3.aspx.cs"


Inherits="WebApplication15.myweb3" %>

<!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">
<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>
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

DESIGN:

1. Home Page

2. First Page:
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

3.Second Page :

4.Third Page :
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

OUTPUT:

1. HOME PAGE:

2. FIRST PAGE:
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

3. SECOND PAGE:

4.THIRD PAGE:
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

b. Create a web application to demonstrate use of Master Page with applying Styles and
Themes for page beautification.

Code For Master Page:

Site1.master

<%@ Master Language="C#" AutoEventWireup="true" CodeFile="site1.master.cs"


Inherits="site1" %>

<!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">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>
&nbsp;</p>
<p>
&nbsp;</p>
</p>
&nbsp;</p>
</asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

Aspx Code:

Default.aspx

<%@ Page Title="" Language="C#" MasterPageFile="~/site1.master" AutoEventWireup="true"


CodeFile="Default.aspx.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

<%@ Page Title="" Language="C#" MasterPageFile="~/site1.master" AutoEventWireup="true"


CodeFile="Default2.aspx.cs" Inherits="Default2" %>

<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>

CSS Code:

Stylesheet.css

body
{
background-color:White;
font:italic |Arial |12;
}
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

Skin Code

Theme.skin

<%--
Default skin template. The following skins are provided as examples only.

1. Named control skin. The SkinId should be uniquely defined because


duplicate SkinId's per control type are not allowed in the same theme.

<asp:GridView runat="server" SkinId="gridviewSkin" BackColor="White" >


<AlternatingRowStyle BackColor="Blue" />
</asp:GridView>

2. Default skin. The SkinId is not defined. Only one default


control skin per control type is allowed in the same theme.

<asp:Image runat="server" ImageUrl="~/images/image1.jpg" />


--%>
<asp:Label runat="server" backcolor=blue/>

Design:

1.Master page:
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

2.Home page:

3.Next page:
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

OUTPUT:
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

c. Create a web application to demonstrate various states of ASP.NET Pages.

1.View State

Aspx code:

WebForm1.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs"


Inherits="WebApplication11.WebForm1" %>

<!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 id="Head1" runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
User Name:-<asp:textbox id="TextBox1" runat="server"></asp:textbox>
<br />
Password :-<asp:textbox id="TextBox2" runat="server"></asp:textbox>
<br />
<asp:button id="Button1" runat="server" onclick="Button1_Click" text="Submit" />
<asp:button id="Button3" runat="server" onclick="Button3_Click" text="Restore" />
</div>
</form>
</body>
</html>

Aspx.cs code:

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;
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

protected void Button1_Click(object sender, EventArgs e)


{

ViewState["name"] = TextBox1.Text;
ViewState["password"] = TextBox2.Text;

TextBox1.Text = TextBox2.Text = string.Empty;


}
protected void Button3_Click(object sender, EventArgs e)
{

if (ViewState["name"] != null)
{
TextBox1.Text = ViewState["name"].ToString();
}
if (ViewState["password"] != null)
{
TextBox2.Text = ViewState["password"].ToString();
}
}

}
}
DESIGN:
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

OUTPUT:

2.Session State

Aspx code:

Default.aspx

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


Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

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

<head id="Head1" runat="server">


<title>
Untitled Page
</title>
</head>

<body>
<form id="form1" runat="server">
<div>
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

&nbsp; &nbsp; &nbsp;

<table style="width: 568px; height: 103px">

<tr>
<td style="width: 209px">
<asp:Label ID="lblstr" runat="server" Text="Enter a String" style="width:94px">
</asp:Label>
</td>

<td style="width: 317px">


<asp:TextBox ID="txtstr" runat="server" style="width:227px">
</asp:TextBox>
</td>
</tr>

<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>

<td style="width: 317px">


<asp:Button ID="btnstr" runat="server"
OnClick="btnstr_Click" Text="Submit the String" />
</td>
</tr>

<tr>
<td style="width: 209px"> </td>

<td style="width: 317px"> </td>


</tr>

<tr>
<td style="width: 209px">
<asp:Label ID="lblsession" runat="server" style="width:231px" >
</asp:Label>
</td>
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

<td style="width: 317px"> </td>


</tr>

<tr>
<td style="width: 209px">
<asp:Label ID="lblshstr" runat="server">
</asp:Label>
</td>

<td style="width: 317px"> </td>


</tr>

</table>

</div>
</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;

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


{
String mystr;

protected void Page_Load(object sender, EventArgs e)


{
this.lblshstr.Text = this.mystr;
this.lblsession.Text = (String)this.Session["str"];
}

protected void btnstr_Click(object sender, EventArgs e)


NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

{
this.mystr = this.txtstr.Text;
this.Session["str"] = this.txtstr.Text;
this.lblshstr.Text = this.mystr;
this.lblsession.Text = (String)this.Session["str"];
}
}

OUTPUT:
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

PRACTICAL NO: 06
a.Create a web application bind data in a multiline textbox by querying in another textbox.

Aspx code
FillStringValue.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="FillStringValue.aspx.cs"


Inherits="UI_QueryString_FillStringValue"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-


transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" runat="server" Text="User name : "></asp:Label>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="btnsend" runat="server" Text="Send Text Value Next Page" OnClick="btnsend_Click" />
</div>
</form>
</body>
</html>

ShowStringValue.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ShowStringValue.aspx.cs"


Inherits="UI_QueryString_ShowStringValue" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

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

</div>
</form>
</body>
</html
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

Aspx.cs Code:

FillStringValue.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 UI_QueryString_FillStringValue : System.Web.UI.Page


{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void btnsend_Click(object sender, EventArgs e)
{
Response.Redirect("ShowStringValue.aspx?Username=" + TextBox1.Text);
}
}

ShowStringValue.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 UI_QueryString_ShowStringValue : System.Web.UI.Page


{
protected void Page_Load(object sender, EventArgs e)
{
string Name = Request.QueryString["Username"].ToString();
Response.Write(Name);
}
}
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

DESIGN:

OUTPUT:
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

b.Create a web application to display records by using database.

Aspx code:

Default.aspx

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


Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

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

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


<asp:TextBox ID="TextBox1" runat="server"
style="position: relative; top: -2px; left: 73px; width: 129px"></asp:TextBox>

</div>
<p>
<asp:Label ID="Label2" runat="server" Text="Name"></asp:Label>
<asp:TextBox ID="TextBox2" runat="server" style="margin-left: 83px"></asp:TextBox>
</p>
<asp:Label ID="Label3" runat="server" Text="Mobile Number"></asp:Label>
<asp:TextBox ID="TextBox3" runat="server" style="margin-left: 24px"></asp:TextBox>
<p>
<asp:Button ID="Button1" runat="server" onclick="Button1_Click"
style="margin-left: 138px" Text="INSERT" Width="68px" />
<asp:Button ID="Button2" runat="server" onclick="Button2_Click"
style="position: relative; top: 0px; left: 25px; width: 78px"
Text="UPDATE" />
<asp:Button ID="Button3" runat="server" onclick="Button3_Click"
Text="Delete" style="margin-left: 65px" Width="105px" />

</p>
<asp:GridView ID="GridView1" runat="server">
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

</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;

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


{

SqlConnection con =new SqlConnection(@"Data


Source=.\SQLEXPRESS;AttachDbFilename='C:\Users\Suju Tadadikar\Documents\Visual
Studio 2010\WebSites\WebSite11\App_Data\Database.mdf';Integrated Security=True;Connect
Timeout=30;User Instance=True");
protected void Page_Load(object sender, EventArgs e)
{

string query = "select * from students";


SqlCommand cmd = new SqlCommand(query, con);
con.Open();
GridView1.DataSource =cmd.ExecuteReader();
GridView1.DataBind();
con.Close();

protected void Button1_Click(object sender, EventArgs e)


{
con.Open();
SqlCommand cmd = new SqlCommand("insert into students values('" + TextBox1.Text +
"','" + TextBox2.Text + "','" + TextBox3.Text + "')" ,con);

cmd.ExecuteNonQuery();
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

con.Close();
Response.Redirect("Default.aspx");
}

protected void Button2_Click(object sender, EventArgs e)


{

con.Open();
SqlCommand cmd = new SqlCommand("update students set s_name='" + TextBox2.Text
+ "' where s_id=' " + TextBox1.Text + "'", con);
cmd.ExecuteNonQuery();
con.Close();
Response.Redirect("Default.aspx");
}

protected void Button3_Click(object sender, EventArgs e)


{
con.Open();
SqlCommand cmd = new SqlCommand("delete from students where s_id=' " +
TextBox1.Text + "'", con);
cmd.ExecuteNonQuery();
con.Close();
Response.Redirect("Default.aspx");

}
}

DESIGN:
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

Output:

Original Database:

Inserting Values:

DataBase with Values:


NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

C.Demonstrate the use of Datalist link control.

Aspx code:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs"


Inherits="DataListControl.WebForm1" %>

<!Doctype html>
<head>
<title></title>
<style type="text/css">
.auto-style2 {
width: 182px;
}
.auto-style4 {
width: 157px;
}
.auto-style5 {
width: 449px;
}
</style>
</head>

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


<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$
ConnectionStrings:shoppingConnectionString2 %>" SelectCommand="SELECT * FROM
[employee]"></asp:SqlDataSource>
<asp:DataList ID="DataList1" runat="server" CellPadding="4" DataKeyField="emp_id"
DataSourceID="SqlDataSource1" ForeColor="#333333">
<AlternatingItemStyle BackColor="White" />
<FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<ItemStyle BackColor="#FFFBD6" ForeColor="#333333" />
<ItemTemplate>
<table cellspacing="1">
<tr>
<td class="auto-style2">
<asp:Label ID="Label1" runat="server" Text='<%# Eval("emp_id")
%>'></asp:Label>
</td>
<td class="auto-style4">
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

<asp:Label ID="Label2" runat="server" Text='<%# Eval("emp_name")


%>'></asp:Label>
</td>
<td class="auto-style5">
<asp:Label ID="Label3" runat="server" Text='<%# Eval("sal")
%>'></asp:Label>
</td>
</tr>
</table>
<br />
<br />
</ItemTemplate>
<SelectedItemStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
</asp:DataList>
</form>
</html>

DATABASE:
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

DESIGN:

OUTPUT:
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

PRACTICAL NO :07
A.Create a web application to display Databinding using dropdownlist control.

Aspx Code:

Default.aspx

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


Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

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

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


<asp:TextBox ID="TextBox1" runat="server"
style="position: relative; top: -2px; left: 73px; width: 129px"></asp:TextBox>

</div>
<p>
<asp:Label ID="Label2" runat="server" Text="Name"></asp:Label>
<asp:TextBox ID="TextBox2" runat="server" style="margin-left: 83px"></asp:TextBox>
</p>
<asp:Label ID="Label3" runat="server" Text="Mobile Number"></asp:Label>
<asp:TextBox ID="TextBox3" runat="server" style="margin-left: 24px"></asp:TextBox>
<br />
<br />
<asp:Label ID="Label4" runat="server" Text="Place"></asp:Label>
<asp:TextBox ID="TextBox4" runat="server"
style="margin-left: 90px; margin-top: 13px"></asp:TextBox>
<br />
<br />
<p>
<asp:Button ID="Button1" runat="server" onclick="Button1_Click"
style="margin-left: 138px" Text="INSERT" Width="68px" />
<asp:Button ID="Button2" runat="server" onclick="Button2_Click"
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

style="position: relative; top: 0px; left: 25px; width: 78px"


Text="UPDATE" />
<asp:Button ID="Button3" runat="server" onclick="Button3_Click"
Text="Delete" style="margin-left: 65px" Width="88px" />

</p>
<asp:GridView ID="GridView1" runat="server">
</asp:GridView>
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/Default2.aspx"
style="position: relative">Generate DropDownList</asp:HyperLink>
</form>
</body>
</html>

Default2.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs"


Inherits="Default2" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
</head>
<body>
<form id="form2" runat="server">
<div>
<asp:DropDownList ID="DropDownList1" runat="server">
</asp:DropDownList>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/Default.aspx"
style="position: relative">Home Page</asp:HyperLink>
<br />
<br />
<asp:Button ID="Button1" runat="server" Text="Find" OnClick="Button1_Click1"
Width="59px" />
<br />
<br />
<asp:GridView ID="GridView1" runat="server" BackColor="White"
BorderColor="#999999"
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

BorderStyle="None" BorderWidth="1px" CellPadding="3" GridLines="Vertical">


<AlternatingRowStyle BackColor="#DCDCDC" />
<FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
<HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
<RowStyle BackColor="#EEEEEE" ForeColor="Black" />
<SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
<SortedAscendingCellStyle BackColor="#F1F1F1" />
<SortedAscendingHeaderStyle BackColor="#0000A9" />
<SortedDescendingCellStyle BackColor="#CAC9C9" />
<SortedDescendingHeaderStyle BackColor="#000065" />
</asp:GridView>
</div>
</form>
</body>
</html>

Aspx.cs Code:
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.SqlClient;

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


{

SqlConnection con = new SqlConnection(@"Data


Source=.\SQLEXPRESS;AttachDbFilename='C:\Users\Suju Tadadikar\Documents\Visual
Studio 2010\WebSites\WebSite18\App_Data\Database.mdf';Integrated Security=True;Connect
Timeout=30;User Instance=True");
protected void Page_Load(object sender, EventArgs e)
{

string query = "select * from student";


SqlCommand cmd = new SqlCommand(query, con);
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

con.Open();
GridView1.DataSource = cmd.ExecuteReader();
GridView1.DataBind();
con.Close();

protected void Button1_Click(object sender, EventArgs e)


{
con.Open();
SqlCommand cmd = new SqlCommand("insert into student values('" + TextBox1.Text +
"','" + TextBox2.Text + "','" + TextBox3.Text + "','" + TextBox4.Text + "')", con);
cmd.ExecuteNonQuery();
con.Close();
Response.Redirect("Default.aspx");
}

protected void Button2_Click(object sender, EventArgs e)


{
con.Open();
SqlCommand cmd = new SqlCommand("update student set s_name='" + TextBox2.Text +
"' where s_id=' " + TextBox1.Text + "'", con);
cmd.ExecuteNonQuery();
con.Close();
Response.Redirect("Default.aspx");
}

protected void Button3_Click(object sender, EventArgs e)


{
con.Open();
SqlCommand cmd = new SqlCommand("delete from student where s_id=' " +
TextBox1.Text + "'", con);
cmd.ExecuteNonQuery();
con.Close();
Response.Redirect("Default.aspx");

}
}
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

Default2.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.SqlClient;
using System.Data;

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


{
string str = @"Data Source=.\SQLEXPRESS;AttachDbFilename='C:\USERS\SUJU
TADADIKAR\DOCUMENTS\VISUAL STUDIO
2010\WEBSITES\WEBSITE18\APP_DATA\DATABASE.MDF';Integrated
Security=True;Connect Timeout=30;User Instance=True";
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(str);
string com = "Select * from student";
SqlDataAdapter adpt = new SqlDataAdapter(com, con);
DataTable dt = new DataTable();
adpt.Fill(dt);
DropDownList1.DataSource = dt;
DropDownList1.DataBind();
DropDownList1.DataTextField = "s_name";
DropDownList1.DataValueField = "s_id";
DropDownList1.DataBind();
}
protected void Button1_Click1(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(str);
SqlCommand cmd = new SqlCommand("select * from student where s_id = '" +
DropDownList1.SelectedValue + "'", con);
SqlDataAdapter Adpt = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
Adpt.Fill(dt);
GridView1.DataSource = dt;
GridView1.DataBind();
Label1.Text = "Record found";
}
}
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

Design:

Home Page:

2.Drop Down Page:


NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

3.Database Table with Values:


NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

OUTPUT:

HOME PAGE:

DROPDOWN PAGE:
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

B. Create a Web Application to display the phone number of an author using


database.
Aspx code:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs"
Inherits="WebApplication6.WebForm1" %>

<!DOCTYPE html>
<html>
<head runat="server">
<title>Display </title>
</head>
<body>
<form id="form1" runat="server">
<h1>Display Author Number </h1>
<br />
<br />
<div class="gridview">
<asp:GridView ID="GridView1" runat="server" CellSpacing="20" CellPadding="10"
AutoGenerateColumns="False" DataSourceID="SqlDataSource1" Height="72px"
Width="152px">
<Columns>
<asp:BoundField DataField="author_no" HeaderText="author_no"
SortExpression="author_no" />
</Columns>
</asp:GridView>
</div>
<br />
<br />
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$
ConnectionStrings:ConnectionString2 %>" SelectCommand="SELECT [author_no] FROM
[author]"></asp:SqlDataSource>
</form>
</body>
</html>
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

Database:

Output:
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

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

Aspx code

Default.aspx

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


Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

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

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


<asp:TextBox ID="TextBox1" runat="server"
style="position: relative; top: -2px; left: 73px; width: 129px"></asp:TextBox>

</div>
<p>
<asp:Label ID="Label2" runat="server" Text="Name"></asp:Label>
<asp:TextBox ID="TextBox2" runat="server" style="margin-left: 83px"></asp:TextBox>
</p>
<asp:Label ID="Label3" runat="server" Text="Mobile Number"></asp:Label>
<asp:TextBox ID="TextBox3" runat="server" style="margin-left: 24px"></asp:TextBox>
<p>
<asp:Button ID="Button1" runat="server" onclick="Button1_Click"
style="margin-left: 138px" Text="INSERT" Width="68px" />
<asp:Button ID="Button2" runat="server" onclick="Button2_Click"
style="position: relative; top: 0px; left: 25px; width: 78px"
Text="UPDATE" />
<asp:Button ID="Button3" runat="server" onclick="Button3_Click"
Text="Delete" style="margin-left: 65px" Width="105px" />

</p>
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

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


</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;

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


{

SqlConnection con =new SqlConnection(@"Data


Source=.\SQLEXPRESS;AttachDbFilename='C:\Users\Suju Tadadikar\Documents\Visual
Studio 2010\WebSites\WebSite11\App_Data\Database.mdf';Integrated Security=True;Connect
Timeout=30;User Instance=True");
protected void Page_Load(object sender, EventArgs e)
{

string query = "select * from students";


SqlCommand cmd = new SqlCommand(query, con);
con.Open();
GridView1.DataSource =cmd.ExecuteReader();
GridView1.DataBind();
con.Close();

protected void Button1_Click(object sender, EventArgs e)


{
con.Open();
SqlCommand cmd = new SqlCommand("insert into students values('" + TextBox1.Text +
"','" + TextBox2.Text + "','" + TextBox3.Text + "')" ,con);
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

cmd.ExecuteNonQuery();
con.Close();
Response.Redirect("Default.aspx");
}

protected void Button2_Click(object sender, EventArgs e)


{
con.Open();
SqlCommand cmd = new SqlCommand("update students set s_name='" + TextBox2.Text
+ "' where s_id=' " + TextBox1.Text + "'", con);
cmd.ExecuteNonQuery();
con.Close();
Response.Redirect("Default.aspx");
}

protected void Button3_Click(object sender, EventArgs e)


{
con.Open();
SqlCommand cmd = new SqlCommand("delete from students where s_id=' " +
TextBox1.Text + "'", con);
cmd.ExecuteNonQuery();
con.Close();
Response.Redirect("Default.aspx");

}
}
DESIGN:
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

Original Database:

1.Inserting Values

2.Updating the 2nd value.


NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

PRACTICAL NO: 08
A.Create a web application to demonstrate various uses and properties of SqlDataSource.

ASPX CODE:

Default.aspx

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


Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

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

<asp:SqlDataSource ID="SqlDataSource1" runat="server"


ConnectionString="<%$ ConnectionStrings:DatabaseConnectionString %>"
SelectCommand="SELECT * FROM [Employee]"></asp:SqlDataSource>

</div>
<p>
&nbsp;</p>
<p>
&nbsp;</p>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataSourceID="SqlDataSource1">
<Columns>
<asp:BoundField DataField="emp_id" HeaderText="emp_id"
SortExpression="emp_id" />
<asp:BoundField DataField="emp_name" HeaderText="emp_name"
SortExpression="emp_name" />
<asp:BoundField DataField="salary" HeaderText="salary"
SortExpression="salary" />
</Columns>
</asp:GridView>
</form>
</body></html>
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

DATABASE:

DESIGN:

OUTPUT:
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

b.Create a web application to demonstrate data binding using DetailsView and FormView
Control.

ASPX CODE:

Default.aspx

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


Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

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

<asp:SqlDataSource ID="SqlDataSource1" runat="server"


ConnectionString="<%$ ConnectionStrings:DatabaseConnectionString %>"
SelectCommand="SELECT * FROM [Employee]"></asp:SqlDataSource>

</div>
<p>
&nbsp;</p>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataSourceID="SqlDataSource1">
<Columns>
<asp:BoundField DataField="emp_id" HeaderText="emp_id"
SortExpression="emp_id" />
<asp:BoundField DataField="emp_name" HeaderText="emp_name"
SortExpression="emp_name" />
<asp:BoundField DataField="salary" HeaderText="salary"
SortExpression="salary" />
</Columns>
</asp:GridView>
<p>
&nbsp;</p>
<asp:FormView ID="FormView1" runat="server" DataSourceID="SqlDataSource1">
<EditItemTemplate>
emp_id:
<asp:TextBox ID="emp_idTextBox" runat="server" Text='<%# Bind("emp_id") %>'
/>
<br />
emp_name:
<asp:TextBox ID="emp_nameTextBox" runat="server"
Text='<%# Bind("emp_name") %>' />
<br />
salary:
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

<asp:TextBox ID="salaryTextBox" runat="server" Text='<%# Bind("salary") %>'


/>
<br />
<asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True"
CommandName="Update" Text="Update" />
&nbsp;<asp:LinkButton ID="UpdateCancelButton" runat="server"
CausesValidation="False" CommandName="Cancel" Text="Cancel" />
</EditItemTemplate>
<InsertItemTemplate>
emp_id:
<asp:TextBox ID="emp_idTextBox" runat="server" Text='<%# Bind("emp_id") %>'
/>
<br />
emp_name:
<asp:TextBox ID="emp_nameTextBox" runat="server"
Text='<%# Bind("emp_name") %>' />
<br />
salary:
<asp:TextBox ID="salaryTextBox" runat="server" Text='<%# Bind("salary") %>'
/>
<br />
<asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True"
CommandName="Insert" Text="Insert" />
&nbsp;<asp:LinkButton ID="InsertCancelButton" runat="server"
CausesValidation="False" CommandName="Cancel" Text="Cancel" />
</InsertItemTemplate>
<ItemTemplate>
emp_id:
<asp:Label ID="emp_idLabel" runat="server" Text='<%# Bind("emp_id") %>' />
<br />
emp_name:
<asp:Label ID="emp_nameLabel" runat="server" Text='<%# Bind("emp_name") %>'
/>
<br />
salary:
<asp:Label ID="salaryLabel" runat="server" Text='<%# Bind("salary") %>' />
<br />

</ItemTemplate>
</asp:FormView>
<br />
<br />
<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False"
DataSourceID="SqlDataSource1" Height="50px" Width="125px">
<Fields>
<asp:BoundField DataField="emp_id" HeaderText="emp_id"
SortExpression="emp_id" />
<asp:BoundField DataField="emp_name" HeaderText="emp_name"
SortExpression="emp_name" />
<asp:BoundField DataField="salary" HeaderText="salary"
SortExpression="salary" />
</Fields>
</asp:DetailsView>
</form>
</body>
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

</html>

DESIGN:

OUTPUT:
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

PRACTICAL NO: 09
Working with GridView control

a.Create a web application to demonstrate use of GridView control template and GridView
hyperlink.

ASPX Code:

Default.aspx

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


CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

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

<asp:SqlDataSource ID="SqlDataSource1" runat="server"


ConnectionString="<%$ ConnectionStrings:DatabaseConnectionString %>"
SelectCommand="SELECT * FROM [Employee]"></asp:SqlDataSource>

</div>
<p>
&nbsp;</p>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
AutoGenerateEditButton="True" AutoGenerateDeleteButton="True"
DataSourceID="SqlDataSource1">
<Columns>
<asp:HyperLinkField DataTextField="emp_id" DataNavigateUrlFields="emp_id"
DataNavigateUrlFormatString="~/Details.aspx?emp_id={0}"
HeaderText="emp_id" ItemStyle-Width = "150" />

<asp:TemplateField HeaderText="emp_name" >


<ItemTemplate>
<%#Eval("emp_name") %>
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="emp_nameTextBox" runat="server" Text='<%# Bind("emp_name")
%>' />
</EditItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<p>
&nbsp;</p>
<br />
<br />
</form>
</body>
</html>

Details.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Details.aspx.cs"


Inherits="Details" %>

<!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">
<asp:Label ID="Label1" runat="server" Text="You are at Details Page "></asp:Label>
<div>

</div>
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/Default.aspx">Home
Page</asp:HyperLink>
</form>
</body>
</html>

ASPX.cs CODE:

Default.aspx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

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

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


{
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
DataTable dt = new DataTable();
dt.Columns.AddRange(new DataColumn[3] { new DataColumn("emp_id"), new
DataColumn("emp_name"), new DataColumn("salary") });
GridView1.DataBind();
}
}
}

DESIGN:

1.HOME PAGE:

2.DETAILS PAGE:
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

OUTPUT:
1.HOME PAGE
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

3.DETAILS PAGE:

c.Create a web application to demonstrate GridView paging and Creating own table
format using GridView.

ASPX Code:

Default.aspx

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


CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

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

</div>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:DatabaseConnectionString %>"
SelectCommand="SELECT * FROM [Employee]"></asp:SqlDataSource>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataSourceID="SqlDataSource1" AllowPaging="True" PageSize="2">
<Columns>
<asp:BoundField DataField="emp_id" HeaderText="emp_id"
SortExpression="emp_id" />
<asp:BoundField DataField="emp_name" HeaderText="emp_name"
SortExpression="emp_name" />
<asp:BoundField DataField="salaray" HeaderText="salaray"
SortExpression="salaray" />
</Columns>

<PagerSettings FirstPageText="First" LastPageText="Last" Mode="NumericFirstLast"


PageButtonCount="4" />
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

</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;
using System.Data;

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


{
protected void Page_Load(object sender, EventArgs e)
{
BindData();
}

protected void BindData()


{
GridView1.DataBind();

}
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GridView1.PageIndex = e.NewPageIndex;
BindData();
}
}
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

DESIGN:

DATABASE:
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

OUTPUT:
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

PRACTICAL NO:10
Working with AJAX and XML
a. Create a web application to demonstrate reading and writing operation with XML.

Writer.cs
using System;
using System.Xml;

public class Writer


{
public static void Main(string[] args)
{

XmlWriterSettings settings = new XmlWriterSettings();


settings.Indent = true;

XmlWriter writer = XmlWriter.Create("D:\\Products.xml", settings);

writer.WriteStartDocument();
writer.WriteComment("This file is generated by the program.");
writer.WriteStartElement("Product");
writer.WriteAttributeString("ID", "001");
writer.WriteAttributeString("Name", "Soap");
writer.WriteElementString("Price", "10.00");
writer.WriteStartElement("OtherDetails");
writer.WriteElementString("BrandName", "X Soap");
writer.WriteElementString("Manufacturer", "X Company");
writer.WriteEndElement();
writer.WriteEndDocument();
writer.Flush();
writer.Close();
Console.WriteLine("created successfully");
Console.ReadLine();
}
}
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

Program.cs code

using System;
using System.Xml;

public class Program


{
public static void Main(string[] args)
{
XmlReader reader = XmlReader.Create("Products.xml");

while (reader.Read())
{
if (reader.NodeType == XmlNodeType.Element
&& reader.Name == "Product")
{
Console.WriteLine("ID = " + reader.GetAttribute(0));
Console.WriteLine("Name = " + reader.GetAttribute(1));
while (reader.NodeType != XmlNodeType.EndElement)
{
reader.Read();
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

if (reader.Name == "Price")
{
while (reader.NodeType != XmlNodeType.EndElement)
{
reader.Read();
if (reader.NodeType == XmlNodeType.Text)
{
Console.WriteLine("Price = {0:C}", Double.Parse(reader.Value));

}
}

reader.Read();

} //end if

if (reader.Name == "OtherDetails")
{
while (reader.NodeType != XmlNodeType.EndElement)
{
reader.Read();
if (reader.Name == "BrandName")
{
while (reader.NodeType != XmlNodeType.EndElement)
{
reader.Read();
if (reader.NodeType == XmlNodeType.Text)
{
Console.WriteLine("Brand Name = " + reader.Value);
}
}
reader.Read();
} //end if

if (reader.Name == "Manufacturer")
{
while (reader.NodeType != XmlNodeType.EndElement)
{
reader.Read();
if (reader.NodeType == XmlNodeType.Text)
{
Console.WriteLine("Manufacturer = " + reader.Value);
}
}
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

}
}
}
}
}

}
Console.ReadLine();
}

OUTPUT:
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

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

1.Using Update Panel Control

ASPX CODE:

WebForm1.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs"


Inherits="anj.WebForm1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

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

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


<br />
<br />
<br />
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
<br />
<br />

</div>
<br />
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>
<br />
<br />
<br />
<asp:Button ID="Button2" runat="server" onclick="Button2_Click" Text="Button" />
</ContentTemplate>
</asp:UpdatePanel>
</form>
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

</body>
</html>

ASPX.CS CODE:
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 anj
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

protected void Button1_Click(object sender, EventArgs e)


{
Label1.Text = DateTime.Now.ToLongTimeString();
}

protected void Button2_Click(object sender, EventArgs e)


{
Label2.Text = DateTime.Now.ToLongTimeString();
}
}
}

OUTPUT:
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

2.Using Update Panel Control and Update Progress Control

ASPX CODE:

WebForm1.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs"


Inherits="Thread_.WebForm1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

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

<asp:ScriptManager ID="ScriptManager1" runat="server">


</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
&nbsp;&nbsp;&nbsp;
<asp:Button ID="Button1" runat="server" Text="Button"
onclick="Button1_Click1" />
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdateProgress ID="UpdateProgress1" runat="server">
<ProgressTemplate>
Loading....
</ProgressTemplate>
</asp:UpdateProgress>

</div>
</form>
</body>
</html>
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

ASPX.CS CODE:

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 Thread_
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

protected void Button1_Click1(object sender, EventArgs e)


{
System.Threading.Thread.Sleep(5000);
}
}
}
DESGIN:

OUTPUT:
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

3. Using Update Panel Control and Timer Control with Trigger

ASPX CODE:

WebForm1.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs"


Inherits="Thread_.WebForm1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

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

<asp:ScriptManager ID="ScriptManager1" runat="server">


</asp:ScriptManager>
<br />
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Timer1" />
</Triggers>
</asp:UpdatePanel>
<asp:Timer ID="Timer1" runat="server" Interval="1000" OnTick="Timer1_Tick">
</asp:Timer>
</div>
</form>
</body>
</html>
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

ASPX.cs CODE:

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 Thread_
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Timer1_Tick(object sender, EventArgs e)
{
Label1.Text = System.DateTime.Now.ToLongTimeString();
}
}
}
Design:

OUTPUT:
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

4. Using two Update Panel Controls in a Webpage via Button.

ASPX CODE:

WebForm1.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs"


Inherits="anjaliii.WebForm1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

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

<asp:ScriptManager ID="ScriptManager1" runat="server">


</asp:ScriptManager>
<br />
<br />
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<br />
<br />
<br />
<br />
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
</ContentTemplate>

</asp:UpdatePanel>

</div>
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>
<br />
<br />
<br />
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

<br />
<asp:Button ID="Button2" runat="server" onclick="Button2_Click" Text="Button" />
</ContentTemplate>
</asp:UpdatePanel>
</form>
</body>
</html>

ASPX.cs CODE:

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 anjaliii
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

protected void Button1_Click(object sender, EventArgs e)


{
Label1.Text = System.DateTime.Now.ToLongTimeString();
Label2.Text = System.DateTime.Now.ToLongTimeString();
}

protected void Button2_Click(object sender, EventArgs e)


{
Label1.Text = System.DateTime.Now.ToLongDateString();
Label2.Text = System.DateTime.Now.ToLongDateString();
}
}
}
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

DESIGN:

OUTPUT:
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

PRACTICAL NO.-11
CREATE A PROGRAM BY USING DLL

1. USING CLASS LIBRARY

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ClassLibrary1
{
public class Class1
{
public int add(int a, int b)
{
int c = a + b;
return c;

}
}

2.CONSOLE APPLICATION:-
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ClassLibrary1;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
ClassLibrary1.Class1 c = new ClassLibrary1.Class1();
int t = c.add(2, 4);
Console.WriteLine("Addition={0}", t);
Console.ReadKey();
NAME:ROHIT GUPTA
CLASS: T.Y IT -B
ROLL NO:7266

}
}
}

OUTPUT

You might also like