Download as pdf or txt
Download as pdf or txt
You are on page 1of 88

Practical No 14

AIM: Design a web page that calculates addition, subtraction, multiplication, division also display colors
to result using radio buttons.

CODE:
WebForm1.aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs"
Inherits="practical_no_14.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"></asp:TextBox>

<p>

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

</p>

<asp:Button ID="Button1" runat="server" Text="Add" Width="107px" OnClick="Button1_Click" />

&nbsp;&nbsp;&nbsp;

<asp:Button ID="Button2" runat="server" Text="Subtract" OnClick="Button2_Click" /> &nbsp;

<asp:Button ID="Button3" runat="server" Text="Divide" Width="106px" OnClick="Button3_Click" />

&nbsp;&nbsp;

<asp:Button ID="Button4" runat="server" Text="Multiply" Width="111px" OnClick="Button4_Click" />

&nbsp;<br />

<br />

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

&nbsp;&nbsp;&nbsp;

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


<p>

<asp:RadioButton ID="RadioButton1" runat="server" Text="Red" AutoPostBack="True" GroupName="a"


OnCheckedChanged="RadioButton1_CheckedChanged" />

</p>

<asp:RadioButton ID="RadioButton2" runat="server" Text="Blue" AutoPostBack="True"


GroupName="a" OnCheckedChanged="RadioButton2_CheckedChanged" />

<p>

<asp:RadioButton ID="RadioButton3" runat="server" Text="Green" AutoPostBack="True"


GroupName="a" OnCheckedChanged="RadioButton3_CheckedChanged" />

</p>

</div>

</form>

</body>

</html>

WebForm1.aspx.cs:
using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

namespace practical_no_14

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

protected void Page_Load(object sender, EventArgs e)

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

{ int a = Convert.ToInt32(TextBox1.Text) + Convert.ToInt32(TextBox2.Text);

TextBox3.Text = a.ToString();

protected void Button2_Click(object sender, EventArgs e)

{ int a = Convert.ToInt32(TextBox1.Text) - Convert.ToInt32(TextBox2.Text);

TextBox3.Text = a.ToString(); }

protected void Button3_Click(object sender, EventArgs e)

{ int a = Convert.ToInt32(TextBox1.Text) / Convert.ToInt32(TextBox2.Text);

TextBox3.Text = a.ToString(); }

protected void Button4_Click(object sender, EventArgs e)

{ int a = Convert.ToInt32(TextBox1.Text) * Convert.ToInt32(TextBox2.Text);

TextBox3.Text = a.ToString(); }

protected void RadioButton1_CheckedChanged(object sender, EventArgs e)

{ TextBox3.ForeColor = System.Drawing.Color.Red; }

protected void RadioButton2_CheckedChanged(object sender, EventArgs e)

{ TextBox3.ForeColor = System.Drawing.Color.Blue; }

protected void RadioButton3_CheckedChanged(object sender, EventArgs e)

{ TextBox3.ForeColor = System.Drawing.Color.Green;

}
Output:
Practical No 15
AIM: Demonstrate the use of calendar control to perform the following tasks – a. display the message
and vacations in calendar control.
b. select day in calendar control using style dates.
c. difference between the two calendar dates
CODE:
WebForm1.aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs"
Inherits="practical_no_15.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"
OnSelectionChanged="Calendar1_SelectionChanged"
OnDayRender="Calendar1_DayRender" Font-Underline="True"></asp:Calendar>
<br/>
<asp:Calendar ID="Calendar2" runat="server" Font-Underline="True"></asp:Calendar>
<br/>
<asp:Button ID="Button1" runat="server" Text="ans " OnClick="Button1_Click"/>
&nbsp;&nbsp;&nbsp;
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</div>
</form>
</body>

</html>
WebForm1.aspx.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace practical_no_15
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{}
protected void Calendar1_SelectionChanged(object sender, EventArgs e)
{
Calendar1.SelectedDayStyle.BackColor = System.Drawing.Color.Yellow;
Calendar1.SelectedDayStyle.ForeColor = System.Drawing.Color.Red;
}
protected void Button1_Click(object sender, EventArgs e)
{
TimeSpan time = Calendar2.SelectedDate - Calendar1.SelectedDate;
Label1.Text = "answer is " + time.Days.ToString() + " Days"; }
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
{
if (e.Day.Date.Year == 2022 && e.Day.Date.Month == 10 && e.Day.Date.Day == 10)
{ e.Cell.Controls.Add(new LiteralControl("<br>my birthday"));
}
}
}
}
Output:
Practical No 16
AIM: Design data entry screen for the student record. It should accept roll number, name, age, address
and email id mobile number, class, total marks, out of marks, password. It should calculate percentage
and grade also and add this record in the list box all the information entry compulsory. password should
be reconfirmed. age should be within 18 to 60 years, email id should be valid, mobile number must have
limit of 10 digit

CODE:
WebForm1.aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs"
Inherits="practical_no_16.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="Name"></asp:Label>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

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

<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server"


ControlToValidate="TextBox1" ErrorMessage="*" ForeColor="Red"></asp:RequiredFieldValidator>

<br />

<br />

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

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp;

&nbsp;&nbsp;&nbsp;
<asp:TextBox ID="TextBox2" runat="server" Width="121px"></asp:TextBox>

<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"


ControlToValidate="TextBox2" ErrorMessage="*" ForeColor="Red"></asp:RequiredFieldValidator>

<asp:RangeValidator ID="RangeValidator2" runat="server" ControlToValidate="TextBox2"


ErrorMessage="Enter valid roll no" ForeColor="Red" MaximumValue="01"
MinimumValue="50"></asp:RangeValidator>

<br />

<br />

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

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

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

<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server"


ControlToValidate="TextBox3" ErrorMessage="*" ForeColor="Red"></asp:RequiredFieldValidator>

<asp:RangeValidator ID="RangeValidator1" runat="server" ControlToValidate="TextBox3"


ErrorMessage="Enter a valid age" ForeColor="Red" MaximumValue="60"
MinimumValue="12"></asp:RangeValidator>

<br />

<br />

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

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp;

&nbsp;&nbsp;&nbsp;

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

<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"


ControlToValidate="TextBox4" ErrorMessage="*" ForeColor="Red"></asp:RequiredFieldValidator>

<br />

<br />

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

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp;
&nbsp;&nbsp;&nbsp;

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

<asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server"


ControlToValidate="TextBox5" ErrorMessage="*" ForeColor="Red"></asp:RequiredFieldValidator>

<asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server"


ControlToValidate="TextBox5" ErrorMessage="Enter a valid e mail" ForeColor="Red"
ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-
.]\w+)*"></asp:RegularExpressionValidator>

<br />

<br />

<asp:Label ID="Label7" runat="server" Text="Mobile Number"></asp:Label>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

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

<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server"


ControlToValidate="TextBox5" ErrorMessage="Enter a valid num" ForeColor="Red"

ValidationExpression="^[6-9]\d{9}$"></asp:RegularExpressionValidator>

<br />

<br />

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

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

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

<asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server"


ControlToValidate="TextBox7" ErrorMessage="*" ForeColor="Red"></asp:RequiredFieldValidator>

<br />

<br />

<asp:Label ID="Label8" runat="server" Text="Total Marks"></asp:Label>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

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

<asp:RequiredFieldValidator ID="RequiredFieldValidator8" runat="server"


ControlToValidate="TextBox8" ErrorMessage="*" ForeColor="Red"></asp:RequiredFieldValidator>
<br />

<asp:Label ID="Label10" runat="server" Text="Out of Marks"></asp:Label>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

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

<asp:RequiredFieldValidator ID="RequiredFieldValidator9" runat="server"


ControlToValidate="TextBox9" ErrorMessage="*" ForeColor="Red"></asp:RequiredFieldValidator>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<br />

<br />

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

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp; &nbsp;&nbsp;

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

<asp:RequiredFieldValidator ID="RequiredFieldValidator10" runat="server"


ControlToValidate="TextBox10" ErrorMessage="*" ForeColor="Red"></asp:RequiredFieldValidator>

<br />

<br />

<asp:Label ID="Label11" runat="server" Text="Confirm Password"></asp:Label>

&nbsp;&nbsp;&nbsp;&nbsp;

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

<asp:RequiredFieldValidator ID="RequiredFieldValidator11" runat="server"


ControlToValidate="TextBox11" ErrorMessage="*" ForeColor="Red"></asp:RequiredFieldValidator>

<asp:CompareValidator ID="CompareValidator1" runat="server" ControlToCompare="TextBox10"


ControlToValidate="TextBox11" ErrorMessage="wrong password"
ForeColor="#CC0000"></asp:CompareValidator>

<br />

<br />

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

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<asp:Label ID="Label12" runat="server" Text="Total percentage"></asp:Label>


&nbsp;&nbsp;&nbsp;

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

<br />

<br />

<br />

<asp:ListBox ID="ListBox1" runat="server" Height="153px" Width="350px">

<asp:ListItem>name</asp:ListItem>

<asp:ListItem>rollno</asp:ListItem>

<asp:ListItem>percentage</asp:ListItem>

<asp:ListItem>grade</asp:ListItem>

</asp:ListBox>

<asp:ValidationSummary ID="ValidationSummary1" runat="server" />

<br />

<br />

<br />

<br />

<br />

<br />

</div>

</form>

</body>

</html>

WebForm1.aspx.cs:
using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;
namespace practical_no_16

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

{ protected void Page_Load(object sender, EventArgs e)

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

{ int total = Convert.ToInt32(TextBox8.Text);

int outof = Convert.ToInt32(TextBox9.Text);

int per = (total * 100) / outof;

string grade = "";

if (per >= 75)

grade = "A";

else if (per >= 65 && per <= 75)

grade = "B";

else if (per >= 50 && per <= 65)

grade = "C";

ListBox1.Items.Add("Name " + TextBox1.Text);

ListBox1.Items.Add("Roll No " + TextBox2.Text);

ListBox1.Items.Add("Percentage " + per.ToString());

ListBox1.Items.Add("Grade " + grade);

Label13.Text = per.ToString();

}
Output:
With valid details:

With invalid details:


Practical No 17

AIM: Write a program to redirect user to another site using asp.net

CODE:
WebForm1.aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs"
Inherits="practical_no_17.WebForm1" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Label ID="Label3" runat="server" Text="Redirecting pages"></asp:Label>
<br />
<br />
<asp:Label ID="Label1" runat="server" Text="Using Server.Transfer"></asp:Label>
:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="WebForm2"
/>
<br />
<br />
<asp:Label ID="Label2" runat="server" Text="Using Responce.Redirect"></asp:Label>
:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Button ID="Button2" runat="server" OnClick="Button2_Click"
Text="WebForm2" />
<br />
</div>
<p>
&nbsp;</p>
<p>
&nbsp;</p>
</form>
</body>
</html>
WebForm2.aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs"
Inherits="practical_no_17.WebForm2" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
<div style="margin-left: 120px">
<asp:Label ID="Label1" runat="server" Text="Welcome to
WebForm2.aspx"></asp:Label>
</div>
</form>
</body>
</html>
WebForm1.aspx.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace practical_no_17
{
public partial class WebForm1 : System.Web.UI.Page
{ protected void Page_Load(object sender, EventArgs e)
{} protected void Button1_Click(object sender, EventArgs e) =>
Server.Transfer("WebForm2.aspx");
protected void Button2_Click(object sender, EventArgs e)
{ Response.Redirect("WebForm2.aspx");
}
}
}
Output:
Using reponse.redirect

Using server.Transfer
Practical No 18a
AIM: Write a program to count no of times the current webpage is submitted to the server using OnClick
event of a button.
CODE:
WebForm1.aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs"
Inherits="practical_no_18a.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="visit count"></asp:Label>

<br />

<br />

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

<br />

<br />

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

&nbsp;&nbsp;&nbsp;&nbsp;

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

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<br />

<br />

</div>

</form>
</body>

</html>

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

namespace practical_no_18a
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
ViewState["count"] = 0;
}
}

protected void Button1_Click(object sender, EventArgs e)


{
ViewState["count"] = Convert.ToInt32(ViewState["count"]) + 1;
Label2.Text = ViewState["count"].ToString();
}
}
}
Output:
Practical No 18b

AIM: Design a Webpage that displays a Welcome message to the user and also shows the number of
visitors to that webpage.
CODE:
WebForm1.aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs"
Inherits="practical_no_18b.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="welcome to my site "></asp:Label>
<br />
<asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>
</div>
</form>
</body>
</html>
WebForm1.aspx.cs:
using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;
namespace practical_no_18b

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

{ protected void Page_Load(object sender, EventArgs e)

{ Label2.Text = Application["visitor"].ToString(); } } }

Global.asax:
namespace practical_no_18b

{ public class Global : System.Web.HttpApplication

{ protected void Application_Start(object sender, EventArgs e)

{ Application["visitor"] = 0; }

protected void Session_Start(object sender, EventArgs e)

{ Application.Lock();

Application["visitor"] = (int)Application["visitor"] + 1;

Application.UnLock();

} protected void Application_BeginRequest(object sender, EventArgs e)

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

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

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

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

{}

}}}

Output:
Practical No 19

AIM: Create a simple Webpage to show how to write and read from a client computer

CODE:
WebForm1.aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs"
Inherits="practical_no_19.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="Username"></asp:Label>

&nbsp;&nbsp;&nbsp;&nbsp;

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

<br />

&nbsp;<br />

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

&nbsp;&nbsp;&nbsp;&nbsp;

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

<br />

<br />

<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Set cookies" />

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="Get cookies" />

<br />
<br />

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

&nbsp;<br />

<br />

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

<br />

<br /> </div>

</form>

</body>

</html>

WebForm1.aspx.cs:
using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

namespace practical_no_19

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

{ protected void Page_Load(object sender, EventArgs e)

{}

protected void Button1_Click(object sender, EventArgs e)

{ Response.Cookies["user"].Value = TextBox1.Text;

Response.Cookies["password"].Value = TextBox2.Text;

} protected void Button2_Click(object sender, EventArgs e)

Label3.Text = Request.Cookies["user"].Value;

Label4.Text = Request.Cookies["password"].Value;
}

Output:
Practical No 20

AIM: Design a webpage using checkbox and panel control. Place 2 textbox i.e., textbox1, textBox2 and a
button control inside a control panel, so that onclick event of this button the factorial of the value
provided in textbox1 will get displayed in textbox2, set the visible property of panel control to false.
Write the C# code to make the panel visible in the “OnCheckedChanged” event of checkbox so that the
factorial operation can be performed

CODE:
WebForm1.aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs"
Inherits="practical_no_20.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="Label3" runat="server" Text="Show Panel"></asp:Label>

<asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="True"


OnCheckedChanged="CheckBox1_CheckedChanged" />

<br />

<asp:Panel ID="Panel1" runat="server" Visible="False">

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

&nbsp;&nbsp;&nbsp;&nbsp;

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

<br />

&nbsp;

<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Factorial" />

<br />
<br />

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

&nbsp;&nbsp;&nbsp;

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

<br />

</asp:Panel> </div>

</form>

</body>

</html>

WebForm1.aspx.cs:
using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

namespace practical_no_20

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

{protected void Page_Load(object sender, EventArgs e)

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

if (CheckBox1.Checked)

{ Panel1.Visible = true; }

else

{ Panel1.Visible = false; }

} protected void Button1_Click(object sender, EventArgs e)

int a = Convert.ToInt32(TextBox1.Text);

int fact = 1;
for (int i = a; i > 0; i--)

{ fact = fact * i; }

TextBox2.Text = fact.ToString(); } } }

Output:
Practical No 21a

AIM: Design a webform using external CSS.

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

<!DOCTYPE html>

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

<head runat="server">

<link href="StyleSheet1.css" rel="stylesheet" type="text/css" />

<title></title>

</head>

<body>

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

<div>

<asp:Label ID="Label1" runat="server" Text="welcome to my website "></asp:Label>

<br />

<br />

<asp:Label ID="Label2" runat="server" Text="enter name " CssClass="Label2"></asp:Label>

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

<br />

<h1> end of the web site </h1>

</div>

</form>

</body>

</html>

External.css:
body {

background-color:aqua;

*{

font-family:Arial;

color:magenta;

h1{

text-align:left;

color:green;

#TextBox1 {

color: yellow;

width: 100px;

background-color: silver;

border: solid black;

.Label2{

color:brown;}

Output:
Practical No 21b

AIM: Design a webform using internal CSS.

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

<!DOCTYPE html>

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

<head runat="server">

<style>

body {

background-color:lightpink; }

*{

font-family:Broadway;

color:red; }

h1{

text-align:left;

color:blue; }

#TextBox1 {

color: aqua;

width: 100px;

background-color:rebeccapurple;

border: solid black; }

.Label2{

color:green; }

</style>

<title></title>

</head>
<body>

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

<div>

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

<br />

<br />

<asp:Label ID="Label2" runat="server" Text=" name " CssClass="Label2"></asp:Label>

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

<br />

<h1> thank you</h1>

</div>

</form>

</body>

</html>

Output:
Practical No 21c

AIM: Design a webform using inline CSS.

CODE:
WebForm1.aspx:

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


Inherits="hitesh21c.WebForm1" %>

<!DOCTYPE html>

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

<head runat="server">

<title></title>

</head>

<body style="background-color:black;">

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

<div>

<asp:Label ID="Label1" runat="server" Text="welcome all" ForeColor="#CCFF66"


Height="54px"></asp:Label>

<br />

<br />

<asp:Label ID="Label2" runat="server" Text="name " CssClass="Label2"


ForeColor="#FFCCFF"></asp:Label>

&nbsp;<asp:TextBox ID="TextBox1" runat="server" ForeColor="#FF6699"></asp:TextBox>

<br />

<h1 style=" text-align:left;color:yellow;"> Thanks for visiting</h1>

</div>

</form>

</body>

</html>
Output:
Practical No 22

AIM: Create a simple webpage with various controls to demonstrate setting and use their property (eg.
AutoPostBack).

a. Onclick of button control display the selected item from the list box in a text box also in the same
webpage display the name of selected item from the drop-down list one from the drop down in label.
also change the font sizes of the same label according to the font size selected from the drop-down list
tool.

b. Display image control for photo.

c. check box provides special formatting (like underline, bold, italic) and radio button provide colors for
labels

CODE:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs"
Inherits="hitesh22.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:ListBox ID="ListBox1" runat="server" AutoPostBack="True">

<asp:ListItem>hitesh</asp:ListItem>

<asp:ListItem>omkar</asp:ListItem>

<asp:ListItem>tushar</asp:ListItem>

<asp:ListItem>vishal</asp:ListItem>

</asp:ListBox>

<p>

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

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

<br />

<br />

<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"


OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged1">

<asp:ListItem>awp</asp:ListItem>

<asp:ListItem>spm</asp:ListItem>

<asp:ListItem>ngt</asp:ListItem>

</asp:DropDownList>

<br />

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

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

<br />

<br />

<asp:DropDownList ID="DropDownList2" runat="server" AutoPostBack="True"


OnSelectedIndexChanged="DropDownList2_SelectedIndexChanged1">

<asp:ListItem Value="20">1</asp:ListItem>

<asp:ListItem Value="15">2</asp:ListItem>

<asp:ListItem Value="10">3</asp:ListItem>

<asp:ListItem Value="5">4</asp:ListItem>

</asp:DropDownList>

<br />

<br />

<br />

<asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="True"


OnCheckedChanged="CheckBox1_CheckedChanged" Text="bold" />

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp;
<asp:RadioButton ID="RadioButton1" runat="server" AutoPostBack="True"
GroupName="parivartan" OnCheckedChanged="RadioButton1_CheckedChanged" Text="cyan" />

<p>

<asp:CheckBox ID="CheckBox2" runat="server" AutoPostBack="True"


OnCheckedChanged="CheckBox2_CheckedChanged" Text="italic" />

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp;

<asp:RadioButton ID="RadioButton2" runat="server" AutoPostBack="True"


GroupName="parivartan" OnCheckedChanged="RadioButton2_CheckedChanged" Text="red" />

</p>

<p>

<asp:CheckBox ID="CheckBox3" runat="server" AutoPostBack="True"


OnCheckedChanged="CheckBox3_CheckedChanged" Text="underline" />

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<asp:RadioButton ID="RadioButton3" runat="server" AutoPostBack="True"


GroupName="parivartan" OnCheckedChanged="RadioButton3_CheckedChanged" Text="hot pink" />

&nbsp;

<p> <asp:Image ID="Image1" runat="server" Height="200px" ImageUrl="~/rocks-


1061540_960_720.jpg" /> </p>

<br />

</div>

</form>

</body>

</html>

WebForm1.aspx.cs:
using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;
namespace practical_no_22

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

{ protected void Page_Load(object sender, EventArgs e)

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

TextBox1.Text = ListBox1.SelectedValue.ToString();

protected void CheckBox1_CheckedChanged(object sender, EventArgs e)

{ Label1.Font.Bold = true; }

protected void CheckBox2_CheckedChanged(object sender, EventArgs e)

{ Label1.Font.Italic = true; }

protected void CheckBox3_CheckedChanged(object sender, EventArgs e)

{ Label1.Font.Underline = true; }

protected void RadioButton1_CheckedChanged(object sender, EventArgs e)

{ Label1.ForeColor = System.Drawing.Color.Cyan; }

protected void RadioButton2_CheckedChanged(object sender, EventArgs e)

{ Label1.ForeColor = System.Drawing.Color.Red; }

protected void RadioButton3_CheckedChanged(object sender, EventArgs e)

{ Label1.ForeColor = System.Drawing.Color.HotPink; }

} protected void DropDownList2_SelectedIndexChanged1(object sender, EventArgs e)

{ Label1.Font.Size = Convert.ToInt32(DropDownList2.SelectedValue); }

protected void DropDownList1_SelectedIndexChanged1(object sender, EventArgs e)

{ Label1.Text = DropDownList1.SelectedValue.ToString();

}
Output:
Practical No 23

AIM: Create a webform to demonstrate use of add rotator control with 5 ads also demonstrate how
keyword filter works.

CODE:
WebForm1.aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs"
Inherits="hitesh23.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" />

<asp:XmlDataSource ID="XmlDataSource1" runat="server"


DataFile="~/XMLFile1.xml"></asp:XmlDataSource> </div>

</form>

</body>

</html>

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

<Advertisements>

<Ad>

<ImageUrl>pexels-elijah-o'donnell-3473569.jpg</ImageUrl>

<NavigateUrl>https://www.google.com</NavigateUrl>

<AlternateText>Ad 1</AlternateText>

<Impressions>20</Impressions>

<Keyword>ad1</Keyword>
<Height>300</Height>

<Width>500</Width>

</Ad>

<Ad>

<ImageUrl>hd-anime-nezuko-t5040jd8hqc0qrmq.jpg</ImageUrl>

<NavigateUrl>https://www.yahoo.com</NavigateUrl>

<AlternateText>Ad 2</AlternateText>

<Impressions>20</Impressions>

<Keyword>ad2</Keyword>

<Height>300</Height>

<Width>500</Width>

</Ad>

<Ad>

<ImageUrl>642268.jpg</ImageUrl>

<NavigateUrl>https://www.youtube.com</NavigateUrl>

<AlternateText>Ad 3</AlternateText>

<Impressions>20</Impressions>

<Keyword>ad3</Keyword>

<Height>300</Height>

<Width>500</Width>

</Ad>

<Ad>

<ImageUrl>197837.jpg</ImageUrl>

<NavigateUrl>https://www.facebook.com</NavigateUrl>

<AlternateText>Ad 4</AlternateText>

<Impressions>20</Impressions>

<Keyword>ad4</Keyword>

<Height>300</Height>

<Width>500</Width>
</Ad>

<Ad>

<ImageUrl>IMG_20180410_172754.jpg</ImageUrl>

<NavigateUrl>https://www.github.com</NavigateUrl>

<AlternateText>Ad 5</AlternateText>

<Impressions>20</Impressions>

<Keyword>ad5</Keyword>

<Height>300</Height>

<Width>500</Width>

</Ad>

</Advertisements>

Output:
Practical No 24

AIM: Create a web form to demonstrate use of user control. Create footer name user control having
reserved (ex: @CompanyName) and use it in a web form.

CODE:
WebUserControl1.ascx:
<%@ Control Language="C#" AutoEventWireup="true"
CodeBehind="WebUserControl1.ascx.cs"
Inherits="practical_no_24.WebUserControl1" %>
<hr />
<h1>welcome to my web site </h1>
WebForm1.aspx:
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="WebForm1.aspx.cs" Inherits="practical_no_24.WebForm1" %
<%@ Register Src="~/WebUserControl1.ascx" TagPrefix="uc2"
TagName="WebUserControl1" %>
<!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="my first page
"></asp:Label>
<br />
<br />
<asp:Button ID="Button1" runat="server" Text="web page 2"
OnClick="Button1_Click" />
&nbsp;&nbsp;&nbsp;
<asp:Button ID="Button2" runat="server" Text="web page 3"
OnClick="Button2_Click" style="height: 29px" />
<uc2:WebUserControl1 runat="server" ID="WebUserControl1" />
</div>
</form>
</body>
</html>
WebForm2.aspx:
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="WebForm2.aspx.cs" Inherits="practical_no_24.WebForm2" %>
<%@ Register Src="~/WebUserControl1.ascx" TagPrefix="uc1"
TagName="WebUserControl1" %>
<!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="my second page
"></asp:Label>
<br />
<br />
<asp:Button ID="Button1" runat="server" Text="web page1"
OnClick="Button1_Click" />
&nbsp;&nbsp;&nbsp;
<asp:Button ID="Button2" runat="server" Text="web page 3"
OnClick="Button2_Click" />
<uc1:WebUserControl1 runat="server" ID="WebUserControl1" />
</div>
</form>
</body>
</html>

WebForm3.aspx:
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="WebForm3.aspx.cs" Inherits="practical_no_24.WebForm3" %>

<%@ Register Src="~/WebUserControl1.ascx" TagPrefix="uc1"


TagName="WebUserControl1" %>
<!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="my third page
"></asp:Label>
<br />
<br />
<asp:Button ID="Button1" runat="server" Text="web page2"
OnClick="Button1_Click" />
&nbsp;&nbsp;&nbsp;
<asp:Button ID="Button2" runat="server" Text="web page 1"
OnClick="Button2_Click" />
<uc1:WebUserControl1 runat="server" ID="WebUserControl1" />
</div>
</form>
</body>
</html>
Output:
Practical No 25

AIM: Create a web application to demonstrate use of master page with applying styles and themes for
page beautificatication.

CODE:
MasterPage.master:
<%@ Master Language="C#" AutoEventWireup="true"
CodeBehind="Site1.master.cs" Inherits="practical_no_25.Site1" %>

<%@ Register Src="~/WebUserControl1.ascx" TagPrefix="uc1"


TagName="WebUserControl1" %>
<!DOCTYPE html>
<uc1:WebUserControl1 runat="server" id="WebUserControl1" />
<html>
<head runat="server">
<title></title>
<style>
body{
background-color:rosybrown
}
#Menu1{
margin:unset;
}
</style>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Menu ID="Menu1" runat="server" BackColor="#FFFF99"
BorderColor="Black" BorderStyle="Solid" DynamicHorizontalOffset="2"
ForeColor="Red" Orientation="Horizontal" Height="80px"
RenderingMode="Table" StaticSubMenuIndent="10px" Width="1700px"
style="margin-top: 0px">
<Items>
<asp:MenuItem NavigateUrl="WebForm2.aspx"
Text="HOME" Value="HOME"></asp:MenuItem>
<asp:MenuItem NavigateUrl="WebForm3.aspx"
Text="HISTORY" Value="HISTORY"></asp:MenuItem>
<asp:MenuItem NavigateUrl="WebForm4.aspx"
Text="GROUND" Value="GROUND"></asp:MenuItem>
<asp:MenuItem NavigateUrl="WebForm5.aspx" Text="HOW
TO PLAY" Value="HOW TO PLAY"></asp:MenuItem>
<asp:MenuItem NavigateUrl="WebForm6.aspx"
Text="ABOUT US " Value="ABOUT US "></asp:MenuItem>
</Items>
</asp:Menu>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1"
runat="server">
</asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>

WebUserControl1.ascx:
<%@ Control Language="C#" AutoEventWireup="true"
CodeBehind="WebUserControl1.ascx.cs"
Inherits="practical_no_25.WebUserControl1" %>
<img src="HEADER.jpg" style="width:1600PX" />
Home.aspx:
<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master"
AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs"
Inherits="practical_no_25.WebForm2" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<style>
body{
background-color:rosybrown;
}
pre{
text-align:center;
padding-left:40px;
font-family:Garamond;
font-size:28px;
}
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1"
runat="server">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;
<br />
<pre>
<i> In 1839, the ability of some materials to create an electrical
charge from light exposure was first observed by the French physicist
Edmond Becquerel [1] Though these initial solar panels were too
inefficient for even simple electric devices, they were used as an
instrument to measure light.[2] The observation by Becquerel was not
replicated again until 1873, when the English electrical engineer
Willoughby Smith discovered that the charge could be caused by light
hitting selenium. After this discovery, William Grylls Adams and Richard
Evans Day published "The action of light on selenium" in 1876,
describing the experiment they used to replicate Smith's results.[1][3]
In 1881, the American inventor Charles Fritts created the first
commercial solar panel, which was reported by Fritts as "continuous,
constant and of considerable force not only by exposure to sunlight but
also to dim, diffused daylight."[4] However, these solar panels were
very inefficient, especially compared to coal-fired power plants. In
1939, Russell Ohl created the solar cell design that is used in many
modern solar panels. He patented his design in 1941.[5] In 1954, this
design was first used by Bell Labs to create the first commercially
viable silicon solar cell.[1] </i></pre>
</asp:Content>
History.aspx:
<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master"
AutoEventWireup="true" CodeBehind="WebForm3.aspx.cs"
Inherits="practical_no_25.WebForm3" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<style>
body{
background-color:rosybrown; }
p{
font-family:Garamond;padding-left:10px;font-
size:35px;border-style:solid;border-width:5px;border-color:black }
h1{
text-align:center;color:teal;font-size:50px}
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1"
runat="server">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;
<br />
<h1>HISTORY OF solarpanel</h1>
<p> <i> A solar cell panel, solar electric panel, photo
voltaic (PV) module or solar panel is an assembly of photovoltaic cells
mounted in a frame generating energy. Solar panels use sunlight as a
source of energy to generate direct current electricity. A collection of
PV modules is call panel, and a system of PV panels is called an array.
Arrays of a photovoltaic system supply solar electricity to electrical
equipment </p>
</asp:Content>
About us.aspx:
<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master"
AutoEventWireup="true" CodeBehind="WebForm6.aspx.cs"
Inherits="practical_no_25.WebForm6" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<style>
body{
background-color:rosybrown;
}
h1,h2{
color:navy;letter-spacing:5px;text-
decoration:underline;text-align:center;font-size:50px
}
p{
margin:80px;list-style-type:square;font-
size:28px;color:green;font-family:Garamond
}
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1"
runat="server">
<h1>GIVE YOUR RESPONSE</h1>
<asp:Label ID="Label1" runat="server" Text="name"></asp:Label>
&nbsp;&nbsp;&nbsp;
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br />
<asp:Label ID="Label2" runat="server" Text="email"></asp:Label>
&nbsp;&nbsp;&nbsp;
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<br />
<br />
<asp:Label ID="Label3" runat="server" Text="what you think in
upcoming years throwball can a part of olympic?"></asp:Label>
<br />
<asp:RadioButton ID="RadioButton1" runat="server" Text="yes" />
<br />
<asp:RadioButton ID="RadioButton2" runat="server" Text="no" />
<br />
<asp:Label ID="Label4" runat="server" Text="comments"></asp:Label>
&nbsp;&nbsp;
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
<br />
<br />
<br />
<br />
<hr style="color:black"/>
<h2>ABOUT US</h2>
<p> "History of TFI" Throwball Federation of India. Archived from the
original on December 1, 2008. Retrieved 2008-11-06.
"Rules and Regulations" Throwball Federation of India. Archived
from the original on December 1, 2008. Retrieved 2008-11-0</p>
</asp:Content>
Output:
Home.aspx:

History.aspx:
About us.aspx:
Practical No 26

AIM: Create a web application to display student’s data from the database using SQL source control
and bind it to grid view. Database fields are (roll no, name, class, mobile no, email-id)

Steps: Step 0 – add database to project

Step 1 – file –> new –> website –> empty website –> Ok

Step 2 – Write click on website name –> add-->ok

Step 3 – Write click on table –> in server explorer –> add new table –> add columns –> click on update

Step 4 – Write click on table mode –> Click show table –> add values

Step 5 – Add GridView control in web form

Step 6 – Click on GridView control –> click new datasource

Step 7 – Follow the datasource configuration wizard

CODE:
WebForm1.aspx:
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="WebForm1.aspx.cs" Inherits="practical_no_26.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"
AutoGenerateColumns="False" DataKeyNames="rollno"
DataSourceID="SqlDataSource1">
<Columns>
<asp:BoundField DataField="rollno"
HeaderText="rollno" ReadOnly="True" SortExpression="rollno" />
<asp:BoundField DataField="name" HeaderText="name"
SortExpression="name" />
<asp:BoundField DataField="class" HeaderText="class"
SortExpression="class" />
<asp:BoundField DataField="phoneno"
HeaderText="phoneno" SortExpression="phoneno" />
<asp:BoundField DataField="emailid"
HeaderText="emailid" SortExpression="emailid" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT * FROM [Table]"></asp:SqlDataSource>
</div>
</form>
</body>
</html>

Output:
Practical No 27

AIM: :Create a simple web page containing the student details (roll no, name, class, phone and email)
Write a program to store the data in database and retrieve using data reader

CODE:
WebForm1.aspx:
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="WebForm1.aspx.cs" Inherits="practical_no_27.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="rollno"></asp:Label>
&nbsp; <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br />
<br />
<asp:Label ID="Label2" runat="server"
Text="name"></asp:Label>
&nbsp;<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<br />
<br />
<asp:Label ID="Label3" runat="server"
Text="class"></asp:Label>&nbsp;
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
<br />
<br />
<asp:Label ID="Label4" runat="server" Text="phone
no"></asp:Label>&nbsp;
<asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
<br />
<br />
<asp:Label ID="Label5" runat="server"
Text="emailid"></asp:Label> &nbsp;
<asp:TextBox ID="TextBox5" runat="server"></asp:TextBox>
<br />
<br />
<asp:Button ID="Button1" runat="server"
OnClick="Button1_Click" Text="add data" />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Button ID="Button2" runat="server"
OnClick="Button2_Click" Text="read data" />
<br />
<br />
<asp:GridView ID="GridView1" runat="server" >
</asp:GridView>
</div>
</form>
</body>
</html>
WebForm1.aspx.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Drawing;
namespace practical_no_27
{ public partial class WebForm1 : System.Web.UI.Page
{ protected void Page_Load(object sender, EventArgs e)
{} protected void Button1_Click(object sender, EventArgs e)
{ SqlConnection conn = new SqlConnection(@"Data
Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\Database1
.mdf;Integrated Security=True");
string str = "insert into Stud values(" + TextBox1.Text + ",
'" + TextBox2.Text + "', '" + TextBox3.Text + "', '" + TextBox4.Text +
"', '" + TextBox5.Text + "')";
SqlCommand cmd = new SqlCommand(str, conn);
conn.Open();
cmd.ExecuteNonQuery();
conn.Close(); }
protected void Button2_Click(object sender, EventArgs e)
{ SqlConnection conn = new SqlConnection(@"Data
Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\Database1
.mdf;Integrated Security=True");
SqlCommand sc2 = new SqlCommand("select * from stud", conn);
conn.Open();
SqlDataReader xd = sc2.ExecuteReader();
GridView1.DataSource = xd;
GridView1.DataBind();
conn.Close();
}
}
}
Output:
Practical No 28

AIM: Create a simple web application to insert, update and delete data from a database

CODE:
WebForm1.aspx:
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="WebForm1.aspx.cs" Inherits="practical_no_28.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="id"></asp:Label> &nbsp;
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br />&nbsp;<br />
<asp:Label ID="Label2" runat="server"
Text="name"></asp:Label> &nbsp;
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<br />
<br />
<asp:Label ID="Label3" runat="server"
Text="class"></asp:Label>&nbsp;
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
<br />
<br />
<asp:Label ID="Label4" runat="server"
Text="address"></asp:Label> &nbsp;
<asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
<br />
<br />
<asp:Button ID="Button1" runat="server"
OnClick="Button1_Click" Text="insert" />&nbsp
<asp:Button ID="Button2" runat="server" OnClick="Button2_Click"
Text="update" />&nbsp;
<asp:Button ID="Button3" runat="server" OnClick="Button3_Click"
Text="delete" />&nbsp;
<asp:Button ID="Button4" runat="server" OnClick="Button4_Click"
Text="show" />&nbsp;
<br />
<br />
<asp:GridView ID="GridView1" runat="server">
</asp:GridView>
</div>
</form>
</body>
</html>

WebForm1.aspx.cs:
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;

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

}
protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection conn = new
SqlConnection(@"DataSource=(LocalDB)\MSSQLLocalDB;AttachDbFilename=|Data
Directory|\Database.mdf;IntegratedSecurity=True");
String a = "insert into stud values (" + TextBox1.Text +
",'" + TextBox2.Text +
"','" + TextBox3.Text + "','" + TextBox4.Text + "')";
SqlCommand cmd = new SqlCommand(a, conn);
conn.Open();
cmd.ExecuteNonQuery();
conn.Close();
}
protected void Button2_Click(object sender, EventArgs e)
{
SqlConnection conn = new
SqlConnection(@"Dataource=(LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataD
irectory|\Database.mdf;IntegratedSecurity=True");
String a = "update stud set name = '" + TextBox2.Text + "',
class = '" +
TextBox3.Text + "', address = '" + TextBox4.Text + "' where
id = " + TextBox1.Text;
SqlCommand cmd = new SqlCommand(a, conn);
conn.Open();
cmd.ExecuteNonQuery();
conn.Close();
}
protected void Button3_Click(object sender, EventArgs e)
{
SqlConnection conn = new
SqlConnection(@"DataSource=(LocalDB)\MSSQLLocalDB;AttachDbFilename=|Data
Directory|\Database.mdf;Integratedsecurity=True");
String a = "delete from stud id = " + TextBox1.Text;
SqlCommand cmd = new SqlCommand(a, conn);
conn.Open();
cmd.ExecuteNonQuery();
conn.Close();
}
protected void Button4_Click(object sender, EventArgs e)
{
SqlConnection conn = new
SqlConnection(@"DataSource=(LocalDB)\MSSQLLocalDB;AttachDbFilename=|Data
Directory|\Database.mdf;Integrated Security=True");
SqlCommand a = new SqlCommand("select * from stud", conn);
conn.Open();
SqlDataReader sdr = a.ExecuteReader();
GridView1.DataSource = sdr;
GridView1.DataBind();
conn.Close();
}
}
}
Output:
Practical No 29

AIM: Write a program to save data in a xml file which user is going to insert from webform.

CODE:
WebForm1.aspx:
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="WebForm1.aspx.cs" Inherits="practical_no_29.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="product
id"></asp:Label>&nbsp;
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br /> <br />
<asp:Label ID="Label2" runat="server" Text="product
name"></asp:Label>&nbsp;
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<br /> <br />
<asp:Label ID="Label3" runat="server"
Text="quantity"></asp:Label>&nbsp;
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
<br />
<br />
<asp:Label ID="Label4" runat="server"
Text="price"></asp:Label>&nbsp;
<asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
<br />
<br />
<asp:Button ID="Button1" runat="server"
OnClick="Button1_Click" Text="submit" />
</div>
</form>
</body>
</html>
WebForm1.aspx.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml;
namespace practical_no_29
{public partial class WebForm1 : System.Web.UI.Page
{ protected void Page_Load(object sender, EventArgs e)
{}
protected void Button1_Click(object sender, EventArgs e)
{ XmlTextWriter a = null;
string filepath = (Server.MapPath("~") + "\\XMLFile1.xml");
a = new XmlTextWriter(filepath, System.Text.Encoding.UTF8);
a.Formatting = Formatting.Indented;
a.WriteStartDocument();
a.WriteStartElement("Product");
a.WriteElementString("id", TextBox1.Text);
a.WriteElementString("Name", TextBox2.Text);
a.WriteElementString("Quantity", TextBox3.Text);
a.WriteElementString("Price", TextBox4.Text);
a.WriteEndElement();
a.WriteEndDocument();
a.Flush();
TextBox1.Text = "";
TextBox2.Text = "";
TextBox3.Text = "";
TextBox4.Text = ""; } } }
Output:
Practical No 30

AIM: Write a program to read an xml file in any of the asp.net control.

CODE:
WebForm1.aspx:
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="WebForm1.aspx.cs" Inherits="practical_no_30.WebForm1" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<asp:GridView ID="GridView1" runat="server">
</asp:GridView>
<div> </div>
</form>
</body>
</html>
WebForm1.aspx.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml;
using System.Data;
namespace practical_no_30
{ public partial class WebForm1 : System.Web.UI.Page
{ protected void Page_Load(object sender, EventArgs e)
{ DataSet ds = new DataSet();
ds.ReadXml(Server.MapPath("~/XMLFile1.xml"));
GridView1.DataSource = ds.Tables[0];
GridView1.DataBind(); }}}
XMLFile1.xml:
<?xml version="1.0" encoding="utf-8" ?>
<details>
<product>
<id>1</id>
<name>rice</name>
<quantity>20</quantity>
<price>400</price>
</product>
<product>
<id>2</id>
<name>wheat</name>
<quantity>40</quantity>
<price>300</price>
</product>
<product>
<id>3</id>
<name>sugar</name>
<quantity>8</quantity>
<price>80000</price>
</product>
<product>
<id>4</id>
<name>salt</name>
<quantity>20</quantity>
<price>2000</price>
</product>
</details>

Output:
Practical No 31

AIM: Create an xml file to store records of 4 persons with name , age, address. Write a program to read
the details of the person whose age is less than 60, From the xml file and display it webpage uising
GridView control.

CODE:
WebForm1.aspx:
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="WebForm1.aspx.cs" Inherits="practical_no_32.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"></asp:GridView>
</div>
</form>
</body>
</html>
WebForm1.aspx.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml.Linq;
namespace practical_no_32
{ public partial class WebForm1 : System.Web.UI.Page
{ protected void Page_Load(object sender, EventArgs e)
{ XDocument a =
XDocument.Load(Server.MapPath("~/XMLFile1.xml"));
var records = from b in a.Root.Elements("person")
where (Convert.ToInt32(b.Element("age").Value) < 60) select new
{ name = b.Element("name").Value,
age = b.Element("age").Value,
address = b.Element("address").Value, };
GridView1.DataSource = records;
GridView1.DataBind();
}
}
}

XmlFIle1.xml:
<?xml version="1.0" encoding="utf-8" ?>
<deatils>
<person>
<name>khushal</name>
<age>19</age>
<address>virar</address>
</person>
<person>
<name>hitesh</name>
<age>20</age>
<address>virar</address>
</person>
<person>
<name>prashik</name>
<age>19</age>
<address>Borivali</address>
</person>
<person>
<name>shubham</name>
<age>21</age>
<address>Gorai</address>
</person>
</deatils>
Output:
Practical No 32

AIM: Create a web page to demonstrate form security with proper authentication and authorization
properties

CODE:
login1.aspx:
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="WebForm1.aspx.cs" Inherits="practical_no_31_32_.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="username"></asp:Label>
&nbsp;&nbsp;&nbsp;
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br />
<br />
<asp:Label ID="Label2" runat="server"
Text="password"></asp:Label>
&nbsp;&nbsp;&nbsp;
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<br />
<br />
<asp:Button ID="Button1" runat="server"
OnClick="Button1_Click" Text="Button" />
<br />
<br />
<asp:Label ID="Label3" runat="server"
Text="Label"></asp:Label>
<br />
</div>
</form>
</body>
</html>

login1.aspx.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;
namespace practical_no_31_32_
{ public partial class WebForm1 : System.Web.UI.Page
{ protected void Page_Load(object sender, EventArgs e)
{ }
protected void Button1_Click(object sender, EventArgs e)
{
if (FormsAuthentication.Authenticate(TextBox1.Text, TextBox2.Text))
{
FormsAuthentication.RedirectFromLoginPage(TextBox1.Text, false);
}
else
{
Label3.Text = "Please Enter Correct Username and Password";
}
}
}
}
hello2.aspx:
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="WebForm2.aspx.cs" Inherits="practical_no_31_32_.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:Label ID="Label1" runat="server"
Text="welcome"></asp:Label> </div>
</form>
</body>
</html>
Web.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.7.2" />
<httpRuntime targetFramework="4.7.2" />
<authentication mode="Forms">
<forms loginUrl="WebForm1.aspx" defaultUrl="WebForm2.aspx">
<credentials passwordFormat="Clear">
<user name="khush" password="1234"/>
</credentials>
</forms>
</authentication>
<authorization>
<deny users="?"/>
</authorization>
</system.web>
</configuration>

Output:
Practical No 33

AIM: Create a simple web application to display time in textbox and when user click on show time
button at that time implement 2 second delay in between and within 2 second delay message wait for
some time (using AJAX control).

CODE:
WebForm1.aspx:
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="WebForm1.aspx.cs" Inherits="practical_no_33.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>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<br />
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
&nbsp;<br />
<br />
<asp:Button ID="Button1" runat="server" Text="Get Time"
OnClick="Button1_Click" />
<br />
<br />
<asp:Label ID="Label1" runat="server" Text=""></asp:Label>
<br />
<br />
<asp:Timer ID="Timer1" runat="server" Interval="2000" Enabled="false"
OnTick="Timer1_Tick">
</asp:Timer>
<br />
<br />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
<asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
</div>
</form>
</body>
</html>

WebForm1.aspx.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace practical_no_33
{ 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 = "Please Wait for some time";
Timer1.Enabled = true; }
protected void Timer1_Tick(object sender, EventArgs e)
{ TextBox1.Text = DateTime.Now.ToString();
Label1.Text = "";
}
}
}

Output:
Practical No 34

AIM: Write a program to hide, show, toggle, slideup, slidedown the content on the respectively click
event using jquery.

CODE:
WebForm1.aspx:
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="WebForm1.aspx.cs" Inherits="practical_no_34.WebForm1" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="jquery-3.4.1.min.js"></script>
<script>
$(document).ready(function(){
$("#hide").click(function(){
$("p").hide();
});
});
$(document).ready(function(){
$("#show").click(function(){
$("p").show();
});
});
$(document).ready(function () {
$("#toggle").click(function () {
$("p").toggle();
});
});
$(document).ready(function () {
$("#flip").click(function () {
$("#panel").slideDown("slow")
});
});
$(document).ready(function () {
$("#panel").click(function () {
$("#panel").slideUp("slow")
});
});
</script>
<style>
#panel,#flip{
padding:5px;
text-align:center;
background-color:yellow;
border:solid 1px #c3c3c3;
}
#panel{
padding:50px;
display:none;
}}
</style>
</head>
<body>
<div>
<div id="flip"> click to slide down</div>
<div id ="panel"> hello world!</div>
<p> <b>This is a little para. </b><br/> </p>
<button id="hide">Hide</button>
<button id="show">Show</button>
<button id="toggle">toggle</button> </div>
</body>
</html>
Output:
Hide:

Show:
Toggle:

Slideup:

Slidedown:

You might also like