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

PART A

SL.NO PROGRAM AIM PAGE NO


01 Develop a html document that make use 06
of formatting, color, lists, font, div,
marquee tags. (using inline styles).
02 Develop a html document using <image> 08
and <table> to produce the following
screen
03 Develop a html document to implements 11

quick view of your college calendar.


Create a document with name
“sidebar.html” with an unordered list of 4
links. Add a target property to each links
using horizontal and vertical frames and
hyperlinks to design the page.
04 Develop a html document to display 17
admission form for a course. (use all the
available form controls).
05 Develop a html 5 document to create a ‘no 20
parking’ sign (using canvas elements).

06 Develop a html 5 document to create a 22


registration form.

Page 1 of 64
PART B
SL.NO PROGRAM AIM PAGE NO
01 Write a Program to perform money 25

conversion.
02 Write a Program to display the difference 27

between the two dates in the calendar.

03 Write a Program to create an 30

Advertisement using Ad rotator.


04 Design a Webpage of a Hotel which 32

display different Menu as per the Time of


Visit.
05 Design an Admission form with client side 36
validations.

PART C
SL.NO PROGRAM AIM PAGE NO

Page 2 of 64
01 Design a website for shopping. 39
1. Include many items in item list. When any item is
selected, its price must be shown automatically.
2. Do the following validations also.
Customer no and Quantity should not be blank and
must contain numeric value.
On clicking ‘purchase’, Add the information customer no, item
selected, price and quantity to a database for each purchase.
In this on clicking ‘Next Purchase’, go to the home page for the
selection of next item. On clicking ‘Show bill’ bill must be
produced only for the current customer.

02 Develop and Design a webpage to enter employee information 45


such as Employee Name, Dept (sales, Accounts, IT) and basic
salary. Use the following buttons for,
 Add → for adding the record to the database
(Insert at least 10 records).
 Display All → for displaying all the records
from the database
 Display Department wise → to display
information’s of only those employees
working in specified department.
 When ADD button is clicked, next page enter
all the values
When clicking Add, show the message
‘Record Inserted’
 When ‘Display all’ is clicked show all the
records in tabular format.
 When ‘Department’ is clicked , accept
department name through script code in the
home page, pass it to the next page and
display the records belonging to the specified
department in above format. If the Specified
department is not found give proper
message.

03 Design a webpage to enter Student information such as Student 52


no, Student Name, address, Course and Percentage Marks. Use
the following buttons for,
 Add -> for adding the record to the database
(Insert at least 5 records).
 Display All -> for displaying all the records
from the database.

04 Design a webpage to enter Book Information in a library such as 57


Accno,Author,Title,Publication,Volume,Edition.Use the
following buttons for,

Page 3 of 64
 Add->For adding the record to the database (Insert at
least 5 records).
 Display All-> For displaying all the records from the
database
 Delete outdated books-> To delete an outdated book by
specifying Accno.
HINT:
Home page format,when ‘Add new books is selected
 When Display Record is clicked,show all the records in
tabular format in the second frame.
 When delete is clicked Check for non-availability of the
record.

Page 4 of 64
PART A

Page 5 of 64
***************************************************************************
NAME: CLETUS REG.NO:186161903
PROGRAM NO: 1
Develop a html document that make use of formatting, color, lists, font, div, marquee
tags. (using inline styles).
***************************************************************************
<html>
<head>
<title>part a</title>
<marquee align="top" bgcolor="white" height="100" width="100%" loop="infinite"
direction="left" >
<h1> CRICKET</h1></marquee>
</head>
<body>
<pre><h1><u>About Cricket</u></h1></pre>
<p>The sport of <b><i>Cricket</i></b> has a know history in the late <span
style="color:red"> 16<sup>th</sup></span> century. <b><i>Cricket</i></b>
is a <big>bat and ball</big> game played between two teams of <del>eleven</del> players
each on a <b><i>Cricket</i></b>field,at the centre of which
is a rectangular <strong>22-yard-long</strong> pitch with a target called the <tt>wicket</tt>
at each end.First<small>50-50</small> world cup
won by WEST INDIES.</p>
<font size="4">
<dl>
<div style="font-family:comic sans ms;font-size:20px;">
<dt><u>CURRENT CHAMPION IN 50-50</u></dt>
<dd>AUSTRALIA in <sup>2015</sup></dd>
</dl>
</font>
<div style="font-family:Baskerville Old Face;font-size:10px;">
<h1><left><u> HIGHEST CENTURY </u></left></h1>
<ol>
<li><b>Sachin Tendulkar </b></li>
<li><i>Ricky Ponting</i></li>
<li><u>Kumar Sangakara<u></li>

Page 6 of 64
</ol>
<h1><LEFT><u><div style="font-family:Algerian;font-size:10px;">
<h1><LEFT><u>LIST OF CURRENT CHAMPION IN T20 </u></LEFT></h1>
<ul><li><H1>India</h1></li>
<li><H2>pakistan</h2></li>
</div>
</body>
</html>
OUTPUT:-

Page 7 of 64
***************************************************************************
NAME: CLETUS REG.NO: 186161903
PROGRAM NO: 2
Develop a HTML document using <image> and <table> to produce the following
screen.
***************************************************************************
<html>
<head>
<title> program 2</title>
</head>
<body>
<table border="1" cellpadding="5" cellspacing="10">
<h1>THE Mobile AMBULANCE-EMRI108 </h1>
<tr>
<th>Specific Equipments</th>
<th colspan="2">Specification Performance</th>
</tr>
<tr>
<td >Retractable protective armour</td>
<td> engine type</td>
<td> jet turbine</td>
</tr>
<tr>
<td> weapon system</td>
<td>Thrust</td>
<td>150 @<br>103%RDS</td>
</tr>
<tr>
<td> instrument Aircraft</td>
<td>Torque</td>
<td> 1750@ <br>95% ROS</td>
</tr>

Page 8 of 64
<tr>
<td rowspan="9"><imgsrc="C:\WebImages\ambulance.jpg"
height="300" width="300"</img></td>
<td>0-60RPM</td>
<td>3*sec</td>
</tr>
<tr>
<td>Top Speed</td>
<td>UNKNOWN</td>
</tr>
<tr>
<td>Break Rate</td>
<td>Excellent</td>
</tr>
<tr>
<td> Wheel Base</td>
<td>141.12.in</td>
</tr>
<tr>
<td>Length</td>
<td> 300.5</td>
</tr>
<tr>
<td>Wheels</td>
<td> alloy</td>
</tr>
<tr>
<td>fuel requirement</td>
<td>14 per litre</td>
</tr>
</table>
</body>
</html>
Page 9 of 64
OUTPUT:-

Page 10 of 64
***************************************************************************
NAME: CLETUS REG.NO: 186161903
PROGRAM NO: 3
Develop a HTML document to implement quick view of your college calendar. Create a
document with name “sidebar.html” with an unordered list of 4 links. Add a target
property to each links using horizontal and vertical frames and hyperlinks to design the
page.
***************************************************************************
#name.html
<html>
<head>
<title>part a</title>
</head>
<body>
<marquee align="top" bgcolor="white" height="100" width="100%" loop="infinite" >
<h1> Shree devi college of science</h1>
</marquee>
</body>
</html>

#about.html
<html>
<head>
<title> About us </title>
</head>
<body background="red">
<pre>
The shreedevi college educational trust is a respected name in the field of academic
endeavour in the coastal district of karanataka, India established in 1992.It was founded by a
team of enlightened
list with a vision to provide quality education to enable the youth to become professional as
well as respect citizen.The chairman to the trust Mr SadhanandaShetty is recipient of the
priyadashini India Gandhi Award.

Page 11 of 64
</body>
</html>

#course.html
<html>
<head>
<title> Course </title>
</head>
<body background="blue">
<font size="5" style="bold">
<pre>
<h1> Courses </h1>
<ul type="square" >
<li>Bpham</li>
<li>Mpham</li>
<li> Pharm D</li>
<li>BPT & MPT</li>
<li>Bsc&Msc Nursing</li>
<li>BHS & BHM</li>
<li>Bsc ID</li>
<li>Bsc FD</li>
<li> MSW</li></ul>
</pre>
</font>
</body>
</html>
#board.html
<html>
<head>
<title> Board Of Governor </title>
</head>
<body background="red">
<dl>
<dt><h1> Board Of Governor </h1></dt>
Page 12 of 64
<dd>Sri A SadanandaShetty,Chairman</dd>
<dd>Sri NidheshShetty, vice chairman</dd>
<dd>SmtMainas.Shetty,Secretory</dd>
<dd>SmtPriyankaN.Shetty, Trustee </dd>
</dl>
</body>
</html>

#pic.html
<html>
<head>
<title> pic </title>
</head>
<body>
<img align=middle src=”D:\image\college.jpg”width=600>
</body></html>

#contact.html
<html>
<head>
<title> Contact Us </title>
</head>
<body background="red">
<pre>
<h1> Contact Us</h1>
All correspondence must be addressed to: Trust office,
ShreeDevi Educational Trust
M.G Road Mangalore
Karanataka state
ph:+91-87451236,54781266
mob:+91-52478135
fax:+91-597841223
email:shredvi@gmail.com
</pre>
Page 13 of 64
</body>
</html>

#college.html
<html>
<head>
<title>
pg 6
</title>
</head>
<frameset rows="20%,*">
<frame src="name.html" name="frame1">
<frameset cols="30%,*">
<frame src="slidebar.html" name="frame2">
<frame src="pic.html" name="frame3">
</frameset></frameset>
</html>

#slidebar.html
<html>
<head>
<title>marque</title>
</head>
<ol>
<li><a href="about.html" target="frame3">About Us</a>
<li><a href="course.html" target="frame3">Course</a>
<li><a href="board.html" target="frame3">Board Of Government</a>
<li><a href="contact.html" target="frame3">Contact Us</a>
</ol>
</marquee>
</html>

Page 14 of 64
OUTPUT:-

Page 15 of 64
Page 16 of 64
***************************************************************************
NAME: CLETUS REG.NO: 186161903
PROGRAM NO:4
Develop a HTML document to display admission form for a course. (Use all the
available form controls).
***************************************************************************
<html>
<head>
<title> form</title>
</head>
<body>
<pre>
<form >
<h1><center>ShreeDevi Admission Form</center></h1>
<table>
<tr>
<td> NAME:</td>
<td><input type="text"></td>
</tr>
<tr>
<td> FATHER NAME:</td>
<td><input type="text"></td>
</tr>
<tr>
<td> ADDRESS:</td>
<td><br><textarea rows="5" cols="10"></textarea></td>
</tr>
<tr>
<td>GENDER:</td>
<td> male<input type="radio" name="a">
female<input type="radio" name="a"></td>
</tr>
<tr>
<td> Hobbies</td>
Page 17 of 64
<td><input type="checkbox"> reading
<input type="checkbox"> dance
<input type="checkbox"> music</td></tr>
<tr>
<td> combination in PU</td>
<td><select list="3">
<option> Commerce</option>
<option> Arts</option>
<option> Science</option>
</select></td>
</tr>
<tr>
<td>Total %:</td>
<td><input type="type"></td>
</tr>
<tr>
<td> year of passing</td>
<td><input type="text"></td>
</tr><tr>
<td>Courses:</td>
<td><select list="6" multiple>
<option> BBM </option>
<option> BCA</option>
<option> B.com</option>
<option> BHS </option>
<option>Bsc ID </option>
<option>Bsc FD </option>
</select></td></tr>
<tr>
<td> upload photo:</td>
<td><input type="file"></td>
</tr>
<tr>
<td>email:</td>
Page 18 of 64
<td><input type="text"></td></tr>
<tr>
<td>mobile no:</td>
<td><input type="text"></td></tr>
<tr>
<td><input type="submit" name="submit"><br>
<input type="reset" name="reset"></td>
</tr>
</form>
</pre>
</body>
</html>

OUTPUT:-

Page 19 of 64
***************************************************************************
NAME: CLETUS REG.NO: 186161903
PROGRAM NO:5
Develop a HTML 5 document to create a ‘no parking’ sign (using canvas elements).
***************************************************************************
<html>
<body>
<canvas id="park" height="300px" width="300" style="border:2px solid red;">
</canvas>

<script>
var canvas = document.getElementById("park");
var ctx = canvas.getContext('2d');

ctx.beginPath();
ctx.strokeStyle="red";
ctx.lineWidth=4;
ctx.arc(150,150,70,0,Math.PI*2);
ctx.moveTo(115,90);
ctx.lineTo(190,210);
ctx.stroke();

ctx.font="40pt serif";
ctx.fillText("NO",120,50);
ctx.fillText("PARKING",35,280);
ctx.font="80pt Times New Roman";
ctx.fillText("P",125,180);
ctx.closePath();
</script>
</body>
</html>

Page 20 of 64
OUTPUT:-

Page 21 of 64
***************************************************************************
NAME: CLETUS REG.NO: 186161903
PROGRAM NO:6
Develop a HTML 5 document to create a registration form.
***************************************************************************
<html>
<head>
<title> Registration Form</title>
<style>
#form1 {width:400px;}
</style>
</head>
<body>
<form id="form1" >
<fieldset>
<table border="2">
<legend width="40px"> Registration Form</legend>
<tr>
<td> First Name</td>
<td><input type="text" placeholder="please enter first name"></td>
</tr>
<tr>
<td> Last Name</td>
<td><input type="text" autofocus placeholder="please enter last name"></td></tr>
<tr>
<td> contact number</td>
<td><input type="text" placeholder="please enter contact number"></td></tr>
<tr>
<td> E-mail</td>
<td><input type="email" placeholder="please enter email id"></td></tr>
<tr>
<td> website URL</td>
<td><input type="url" placeholder="please enter url"></td>
</tr>
Page 22 of 64
<tr>
<td> date of birth</td>
<td><input type="date" max="2015-01-01" value="2015-10-5"></td>
</tr>
<tr>
<td> Ability to learn new technology</td>
<td><input type="range" max="20" min="0" value="5"></td>
</tr>
<tr>
<td> time of registration</td>
<td><input type="time" value="12:00"></td>
</tr>
<tr>
<td colspan="2"><input type="submit" name="submit">
<input type="reset" name="reset"></td>
</tr>
</table>
</filedset>
</form>
</body>
</html>
OUTPUT:-

Page 23 of 64
PART B

Page 24 of 64
***************************************************************************
NAME: CLETUS REG.NO: 186161903
PROGRAM NO:1
Write a Program to perform money conversion.
*************************************************************************
using System;
usingSystem.Data;
usingSystem.Configuration;
usingSystem.Web;
usingSystem.Web.Security;
usingSystem.Web.UI;
usingSystem.Web.UI.WebControls;
usingSystem.Web.UI.WebControls.WebParts;
usingSystem.Web.UI.HtmlControls;

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


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

}
protected void Button1_Click(object sender, EventArgs e)
{
int x = int.Parse(TextBox1.Text);
double y;
string m = DropDownList1.SelectedValue;
string n = DropDownList2.SelectedValue;
if (m == "dollar" && n == "rupees")
{
y = x * 64;
TextBox2.Text = y.ToString();
}
else if (m == "rupees" && n == "dollar")
{
y = x * 0.64;
TextBox2.Text = y.ToString();
}
else if (m == n )
{
TextBox2.Text = x.ToString();
}

protected void Button2_Click(object sender, EventArgs e)


{
TextBox1.Text = "";
TextBox2.Text = "";
}
}
Page 25 of 64
OUTPUT:-

Page 26 of 64
***************************************************************************
NAME: CLETUS REG.NO: 186161903
PROGRAM NO: 2
Write a Program to display the difference between the two dates in the calendar.
***************************************************************************
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 Button1_Click(object sender, EventArgs e)
{

DateTime a=Calendar1.SelectedDate;
DateTime b=Calendar2.SelectedDate;
if(a<b){
DateTime temp;
temp=a;
a=b;
b=temp;
}
TimeSpan dif=a-b;
Label1.Text = dif.Days.ToString();
int years=0,months=0,days=0,mn=0,yr;
mn=b.Month;
years=dif.Days/365;
Label2.Text=years.ToString();
days=dif.Days%365;
yr=b.Year;
while(mn!=a.Month && yr!=a.Year )
{
if(mn==13){
mn=1;
yr=yr+1;
}
if(mn==1 || mn==3 || mn==5 || mn==7 || mn==8 || mn==10 || mn==12)
{
if(days>=31)
{
days-=31;
Page 27 of 64
months++;
mn++;
}
else
break;
}
else if(mn==4 || mn==6 || mn==9 || mn==11)
{
if(days>=30)
{
days-=30;
months++;
mn++;
}
else
break;
}
else if(mn==2)
{
if(days>=28)
{
if(DateTime.IsLeapYear(a.Year))
days-=29;
else{
days-=28;
}
months++;
mn++;
}
else
break;
}
}
Label4.Text=days.ToString();
Label3.Text=months.ToString();

}
}

Page 28 of 64
OUTPUT:-

Page 29 of 64
***************************************************************************
NAME: CLETUS REG.NO: 186161903
PROGRAM NO:3
Write a Program to create an Advertisement using Ad rotator.
***************************************************************************
Add.xml
<?xml version="1.0" encoding="utf-8" ?>
<Advertisements>
<Ad>
<NavigateUrl>http://www.gmail.com </NavigateUrl>
<ImageUrl>~/img/breakfast3.jpg</ImageUrl>
</Ad>
<Ad>
<ImageUrl>~/img/7up1.jpg</ImageUrl>
</Ad>
<Ad>
<ImageUrl>~/img/7up2.jpg</ImageUrl>
</Ad>
</Advertisements>

Default.aspx
Drag the AdRotator tool.
AdRotator -> Properties -> AdvertisementFile -> ~Add.xml

Source code
<head>
<meta http-equiv=”refresh” content=”2” />
</head>

Page 30 of 64
OUTPUT:-

***************************************************************************
NAME:CLETUS REG.NO: 186161903

Page 31 of 64
PROGRAM NO: 4
Design a Webpage of a Hotel which display different Menu as per the Time of Visit.
***************************************************************************
using System;
usingSystem.Data;
usingSystem.Configuration;
usingSystem.Web;
usingSystem.Web.Security;
usingSystem.Web.UI;
usingSystem.Web.UI.WebControls;
usingSystem.Web.UI.WebControls.WebParts;
usingSystem.Web.UI.HtmlControls;

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


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

Panel2.Visible = false;
Panel3.Visible = false;
Panel4.Visible = false;
Panel5.Visible = false
}

protected void ImageButton1_Click(object sender, ImageClickEventArgs e)


{
DateTime t1 = DateTime.Now;
DateTime t2 = Convert.ToDateTime("6:00 am");
DateTime t3 = Convert.ToDateTime("12:00 pm");
DateTime t4 = Convert.ToDateTime("4:00 pm");
DateTime t5 = Convert.ToDateTime("8:00 pm");
DateTime t6 = Convert.ToDateTime("11:00 pm");
if (t1 >= t2 && t1 < t3)
{
Panel1.Visible = false;
Panel2.Visible = true;
}
if (t1 >= t3 && t1 < t4)
{
Panel1.Visible = false;
Panel3.Visible = true;
}

if (t1 >= t4 && t1 < t5)


{
Panel1.Visible = false;
Panel4.Visible = true;
}
if (t1 >= t5 && t1 < t6)
Page 32 of 64
{
Panel1.Visible = false;
Panel5.Visible = true;
}
if(t1<t2 || t1>t6)
{
Panel1.Visible = false;
Response.Write("hotel closed");

}
}
protected void Button3_Click(object sender, EventArgs e)
{
Panel1.Visible = true;
Response.Write("Thanks for your order");
}
}
}

OUTPUT:-

Page 33 of 64
BREAKFAST:
LUNCH:

SNACKS:

Page 34 of 64
Dinner

Dinner

***************************************************************************
NAME: CLETUS REG.NO: 186161903
PROGRAM NO:5
Design an Admission form with client side validations.
***************************************************************************

Page 35 of 64
Step 1: For TextBox1(Name), we are implementing Validation.
Toolbox -> Validation -> Drag RequiredFieldValidator
Properties -> Error message: Enter Name
Control toValidate:Textbox1

Step 2: For TextBox2(Regno), we are implementing Validation.


Toolbox -> Validation -> Drag RangeValidator on TextBox2. Properties -> Error message:
Out of Range.
Control toValidate:Textbox2
Properties -> MaximumValue: 136870120
Minimum Value: 136870101.

Step 3: For TextBox3(DOB), we are implementing Validation.


Toolbox -> Validation -> Drag RequiredFieldValidator on TextBox3.
Properties -> Error message: Enter DOB
Control toValidate:Textbox3

Step 4: For TextBox4(Dept), we are implementing Validation.


Toolbox -> Validation -> Drag RequiredFieldValidator on TextBox4.
Properties -> Error message: Enter Dept
Control toValidate:Textbox4

Step 5: For TextBox5(Addr), we are implementing Validation.


Toolbox -> Validation -> Drag RequiredFieldValidator on TextBox5.
Properties -> Error message: Enter address
Control toValidate:Textbox5
Step 6:
Toolbox -> Drag TextBox6(Phone no)
Step 7: For TextBox7(personal no), we are implementing Validation.
Toolbox -> Validation -> Drag RequiredFieldValidator on TextBox7.
Properties -> Error message:must be same
Control toCompare:Textbox6
Control toValidate:Textbox7
Operator:Equal
Page 36 of 64
Type:Integer

Step 8: For TextBox8(HomePhone no), we are implementing Validation.


Toolbox -> Validation -> Drag RequiredFieldValidator on TextBox8.
Properties -> Error message: Enter alternative phone Number
Control toCompare:Textbox7
Control toValidate:Textbox8
Operator:NotEqual
Type:Integer
Step 9: For TextBox9(EmailId), we are implementing Validation.
Toolbox -> Validation -> Drag RegularExpressionValidator on TextBox9.
Properties -> Error message: Enter Email
Control toValidate:Textbox9
Properties -> ValidationExpression: Internet e-mail address
OUTPUT:-

Page 37 of 64
PART C

***************************************************************************
NAME: CLETUS REG.NO: 186161903
PROGRAM NO: 1
Design a website for shopping.

Page 38 of 64
1. Include many items in item list. When any item is selected, its price must be
shown automatically.
2. Do the following validations also.
Customer no and Quantity should not be blank and must contain numeric
value.
On clicking ‘purchase’, Add the information customer no, item selected, price and
quantity to a database for each purchase.
In this on clicking ‘Next Purchase’, go to the home page for the selection of next item.
On clicking ‘Show bill’ bill must be produced only for the current customer.
***************************************************************************
Creating Database
Right click on Solution Explorer Path → Add New Item → Select SQL Database → Click
Add
Table
Right click on Tables(Server Explorer → Data Connection → Database.mdf) →Add New
Table

Panel 1:

Validation:
1)Customer No(TextBox1) → Drag RequiredFieldValidator → Right click on it
Properties → ErrorMessage → Customer Number cannot be empty
ControlToValidate → TextBox1

Page 39 of 64
2)Quantity(TextBox5) ) → Drag RequiredFieldValidator → Right click on it
Properties → ErrorMessage → Quantity cannot be empty
ControlToValidate → TextBox5

Panel 2:

Panel 3:

Connection of Sql Data Source


Configure Data Source.. → click New Connection (Browse the sql source file (.mdf)) →
Next →

Page 40 of 64
Select CheckBox iname, rate, quantity, price → then click where →
Column: cno
Operator ≔
Source: Control
Control Id: Label5(customer no in panel2)
Click Add → Next → Test Query → Finish
File Name: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;
publicpartialclass_Default : System.Web.UI.Page
{
protectedvoid Page_Load(object sender, EventArgs e)
{
Panel2.Visible = false;
Panel3.Visible = false;
TextBox4.ReadOnly = true;

//Purchase Button
protectedvoid Button1_Click1(object sender, EventArgs e)
{
Panel1.Visible = false;
Panel2.Visible = true;
int total = Convert.ToInt32(TextBox4.Text) * Convert.ToInt32(TextBox5.Text);
SqlConnection con = newSqlConnection
(@"DataSource=.\SQLEXPRESS;AttachDbFilename=F:\We\App_Data\Database.mdf;
Integrated Security=True;User Instance=True");
con.Open();
SqlCommand com = newSqlCommand("insert into shop values('" + TextBox1.Text + "','" +
DropDownList1.SelectedItem + "','" + TextBox4.Text + "','" + TextBox5.Text + "','" + total +
"')", con);
com.ExecuteNonQuery();
con.Close();
Label1.Text = TextBox1.Text;
Label2.Text = DropDownList1.SelectedItem.ToString();
Label3.Text = TextBox4.Text;
Label4.Text = TextBox5.Text;
}

//Reset Button
protectedvoid Button2_Click(object sender, EventArgs e)
Page 41 of 64
{
TextBox1.Text = "";
TextBox2.Text = "";
TextBox3.Text = "";
TextBox4.Text = "";
TextBox5.Text = "";
DropDownList1.SelectedIndex = -1;
}

//Next Purchase Button


protectedvoid Button3_Click(object sender, EventArgs e)
{
Panel1.Visible = true;
Panel2.Visible = false;
TextBox1.ReadOnly = true;
TextBox2.ReadOnly = true;
TextBox3.ReadOnly = true;
Button2.Enabled = false;
}

//Show Bill Button


protectedvoid Button4_Click(object sender, EventArgs e)
{
Panel1.Visible = false;
Panel2.Visible = false;
Panel3.Visible = true;
Label5.Text = TextBox1.Text;
Label6.Text = TextBox2.Text;
Label7.Text = TextBox3.Text;
int sum = 0;
for (int i = 0; i < GridView1.Rows.Count; i++)
{
sum += Convert.ToInt32(GridView1.Rows[i].Cells[3].Text);
}
Label8.Text = sum.ToString();

//Exit Button
protectedvoid Button5_Click(object sender, EventArgs e)
{
Panel2.Visible = false;
Panel3.Visible = false;
Panel1.Visible = true;
TextBox1.ReadOnly = false;
TextBox2.ReadOnly = false;
TextBox3.ReadOnly = false;
TextBox1.Text = "";
TextBox2.Text = "";

Page 42 of 64
TextBox3.Text = "";
TextBox4.Text = "";
TextBox5.Text = "";
DropDownList1.SelectedIndex = -1;
Button2.Enabled = true;
}

//Drop DownList1 code


protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
TextBox4.Text = DropDownList1.SelectedValue;
}
}

OUTPUT:-

Main:

Purchase:

NextPurchase:

Page 43 of 64
Show Bill:

Page 44 of 64
***************************************************************************
NAME: CLETUS REG.NO: 186161903

PROGRAM NO: 2

Develop Design a webpage to enter employee information such as Employee no, Name,
Dept (sales, Accounts, IT) and basic salary. Use the following buttons for,

 Add → for adding the record to the database (Insert at least 10


records).
 Display All → for displaying all the records from the database
 Display Department wise → to display information’s of only those
employees working in specified department.
 When ADD button is clicked, next page enter all the values
When clicking Add, show the message ‘Record Inserted’
 When ‘Display all’ is clicked show all the records in tabular format.
 When ‘Department’ is clicked , accept department name through
script code in the home page, pass it to the next page and display
the records belonging to the specified department in above format.
If the Specified department is not found give proper message.
***************************************************************************
Table:emp

File Name:Default.aspx

Page 45 of 64
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

publicpartialclassDefault2 : System.Web.UI.Page
{
protectedvoid Page_Load(object sender, EventArgs e)
{

}
protected void Button1_Click(object sender, EventArgs e)
{
Response.Redirect("Add.aspx);
}
protected void Button2_Click(object sender, EventArgs e)
{
Response.Redirect("Display.aspx);
}
protectedvoid Button3_Click(object sender, EventArgs e)
{
Panel2.Visible = true;
Panel1.Visible = false;
}
protectedvoid Button4_Click(object sender, EventArgs e)
{
Response.Redirect("Department.aspx?name=" + TextBox1.Text);
}
}

File Name:Add.aspx

Page 46 of 64
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;
publicpartialclassAdd : System.Web.UI.Page
{
protectedvoid Page_Load(object sender, EventArgs e)
{

}
protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection con = newSqlConnection
(@"Data Source=.\SQLEXPRESS;AttachDbFilename=F:\partc2\App_Data\emp.mdf;
Integrated Security=True;User Instance=True");
con.Open();
SqlCommand com = newSqlCommand("insert into emp
values('"+TextBox1.Text+"','"+TextBox2.Text+"','"+TextBox3.Text+"','"+RadioButtonList2.
SelectedItem+"')", con);
com.ExecuteNonQuery();
con.Close();
Label1.Visible = true;
Label1.Text = "Record Added";
}
protected void Button2_Click(object sender, EventArgs e)
{
Response.Redirect("Default.aspx);
}

protectedvoid Button3_Click(object sender, EventArgs e)


{
TextBox1.Text = "";
TextBox2.Text = "";
TextBox3.Text = "";
RadioButtonList2.SelectedIndex = -1;
Label1.Visible = false;
}
}

File Name:Display.aspx

Drag and Drop SqlDataSource from ToolBox

Drag and Drop GridView from ToolBox

Page 47 of 64
Configure Data Source.. → click New Connection (Browse the sql source file (.mdf)) →
Next →
Select CheckBox empno,name,salary,department→ Next → Test Query → Finish

protected void Button1_Click(object sender, EventArgs e)


{
Response.Redirect("Default.aspx);
}

File Name:Department.aspx

Connection of Sql Data Source


Configure Data Source.. → click New Connection (Browse the sql source file (.mdf)) →
Next →
Select CheckBox empno,name,salary,department→ then click where →
Column: department
Operator ≔
Source: Control
Control Id: Label1
Click Add → Next → Test Query → Finish

Page 48 of 64
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

publicpartialclassDepartment : System.Web.UI.Page
{
protectedvoid Page_Load(object sender, EventArgs e)
{
Label1.Text = Request.QueryString["name"];
int n;
n = GridView1.Rows.Count;
if (n == 0)
{
Label2.Text = "Record not found";
}
else
{
Label2.Text = "Record found";
}
}
}

protected void Button1_Click(object sender, EventArgs e)


{
Response.Redirect("Default.aspx);
}

Page 49 of 64
OUTPUT:-

ADD:

DISPLAY:

Page 50 of 64
DEPARTMENT:

***************************************************************************
NAME: CLETUS REG.NO: 186161903

PROGRAM NO: 3

Page 51 of 64
Design a webpage to enter Student information such as Student no, Student Name,
address, Course and Percentage Marks. Use the following buttons for,


Add -> for adding the record to the database (Insert at least 5
records).
 Display All -> for displaying all the records from the database.
***************************************************************************

Table:stud

File Name:Default.aspx

Drag and Drop SqlDataSource from ToolBox

Drag and Drop GridView from ToolBox

Configure Data Source.. → click New Connection (Browse the sql source file (.mdf)) →
Next →
Select CheckBox studno,studname,mark1,mark2,mark3,total,perc,grade→ Next → Test
Query → Finish

File Name:Display.aspx

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

Page 52 of 64
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
publicpartialclass_Default : System.Web.UI.Page
{
protectedvoid Page_Load(object sender, EventArgs e)
{
GridView1.Visible = false;
}

protectedvoid Button2_Click(object sender, EventArgs e)


{
GridView1.Visible = true;
}
}

protected void Button1_Click(object sender, EventArgs e)


{
Response.Redirect("Add.aspx);
}

File Name:Add.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;
publicpartialclassAdd : System.Web.UI.Page
{
protectedvoid Page_Load(object sender, EventArgs e)
{

}
Page 53 of 64
protectedvoid Button1_Click(object sender, EventArgs e)
{

int total, m1, m2, m3;


String percentage,grade="";
m1 = int.Parse(TextBox3.Text);
m2 = int.Parse(TextBox4.Text);
m3 = int.Parse(TextBox5.Text);
total = m1 + m2 + m3;
float perc = (total / 3);
percentage=perc.ToString();
if (m1 < 35 || m2 < 35 || m3 < 35)
{
grade = "fail";
}
elseif (perc >= 90)
{
grade = "A+";
}
elseif (perc >= 60)
{
grade = "A";
}
elseif (perc >= 50)
{
grade = "B";
}
elseif (perc >= 35)
{
grade = "C";
}
SqlConnection con = newSqlConnection
(@"Data Source=.\SQLEXPRESS;AttachDbFilename=F:\partc3\App_Data\stud.mdf;
Integrated Security=True;User Instance=True");
con.Open();
SqlCommand com = newSqlCommand("insert into student
values('"+TextBox1.Text+"','"+TextBox2.Text+"','"+m1+"','"+m2+"','"+m3+"','"+total+"','"+
percentage+"','"+grade+"')", con);
com.ExecuteNonQuery();
con.Close();
Label1.Visible = true;
Label1.Text="Record Added";

}
protectedvoid Button2_Click(object sender, EventArgs e)
{
Label1.Visible = false;
TextBox1.Text = "";
TextBox2.Text = "";
TextBox3.Text = "";

Page 54 of 64
TextBox4.Text = "";
TextBox5.Text = "";
}
}
protected void Button3_Click(object sender, EventArgs e)
{
Response.Redirect("Default.aspx);
}
OUTPUT:-

ADD:

DISPLAY:

Page 55 of 64
***************************************************************************
NAME: CLETUS REG.NO: 186161903

PROGRAM NO: 4
Page 56 of 64
Design a webpage to enter Book Information in a library such as
Accno,Author,Title,Publication,Volume,Edition.Use the following buttons for,

 Add->For adding the record to the database (Insert at least 5 records).


 Display All-> For displaying all the records from the database
 Delete outdated books-> To delete an outdated book by specifying Accno.

HINT:

Home page format,when ‘Add new books is selected

 When Display Record is clicked,show all the records in tabular format in the
second frame.
 When delete is clicked Check for non-availability of the record.

***************************************************************************

TABLE:book

File Name:Default.aspx

Default.aspx Source:

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


Inherits="_Default" %>

Page 57 of 64
<!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:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/add.aspx"
Target="frame2">Add new Records</asp:HyperLink>
<p>
<asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl="~/display.aspx"
Target="frame2">Display Records</asp:HyperLink>
</p>
<p>
<asp:HyperLink ID="HyperLink3" runat="server" Target="frame2"
NavigateUrl="~/Delete.aspx">Delete Records</asp:HyperLink>
</p>
</form>
</body>
</html>

File Name: HTMLPage.htm

<!DOCTYPEhtmlPUBLIC"-//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>
<framesetcols="25%,*">
<framename="frame1" src="default.aspx"></frame>
<framename="frame2" src=""></frame>
</frameset>
<title></title>
</head>
<body>
</body>
</html>

File Name:add.aspx

Page 58 of 64
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;
publicpartialclassadd : System.Web.UI.Page
{
protectedvoid Page_Load(object sender, EventArgs e)
{

}
protectedvoid Button1_Click(object sender, EventArgs e)
{
SqlConnection con = newSqlConnection
(@"DataSource=.\SQLEXPRESS;AttachDbFilename=F:\PartC\App_Data\book.mdf;
Integrated Security=True;User Instance=True");
con.Open();
SqlCommand com = newSqlCommand("insert into book values('" + TextBox1.Text + "','" +
TextBox2.Text + "','" + TextBox3.Text + "','" + TextBox4.Text + "','" + TextBox5.Text + "','"
+ TextBox6.Text + "')", con);
com.ExecuteNonQuery();
con.Close();
Label1.Text = "Record Added Successfully";
Label1.Visible = true;

protectedvoid Button2_Click(object sender, EventArgs e)


{

Page 59 of 64
TextBox1.Text = "";
TextBox2.Text = "";
TextBox3.Text = "";
TextBox4.Text = "";
TextBox5.Text = "";
TextBox6.Text = "";
Label1.Text = "";
Label1.Visible = false;
}
}

File Name:Display.aspx

Drag and Drop SqlDataSource from ToolBox

Drag and Drop GridView from ToolBox

Configure Data Source.. → click New Connection (Browse the sql source file (.mdf)) →
Next →
Select CheckBox accno,author,title,publication,edition,volume → Next → Test Query →
Finish

File Name:Delete.aspx

Page 60 of 64
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;
publicpartialclassDelete : System.Web.UI.Page
{
protectedvoid Page_Load(object sender, EventArgs e)
{

}
protectedvoid Button1_Click(object sender, EventArgs e)
{
SqlConnection con = newSqlConnection
(@"DataSource=.\SQLEXPRESS;AttachDbFilename=F:\PartC\App_Data\book.mdf;
Integrated Security=True;User Instance=True");
con.Open();
SqlCommand com = newSqlCommand("select * from book where
accno='"+TextBox1.Text+"'", con);
SqlDataReader dr;
dr = com.ExecuteReader();
Panel1.Visible = true;
Label1.Visible = true;
if (dr.Read())
{
Label1.Text = "Record Deleted";
Label2.Text = dr[0].ToString();
Label3.Text = dr[1].ToString();
Label4.Text = dr[2].ToString();
Label5.Text = dr[3].ToString();
Label6.Text = dr[4].ToString();
Label7.Text = dr[5].ToString();

Page 61 of 64
dr.Close();
com = newSqlCommand("delete from book where accno='" + TextBox1.Text + "'", con);
com.ExecuteNonQuery();
}
else
{
Label1.Text = "Record Not Found";
Panel1.Visible = false;
}

con.Close();
}
}

OUTPUT:-

ADD:

DISPLAY:

Page 62 of 64
DELETE:

Page 63 of 64
THE END

Page 64 of 64

You might also like