Professional Documents
Culture Documents
Part A
Part A
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
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.
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;
}
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();
}
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;
}
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;
Panel2.Visible = false;
Panel3.Visible = false;
Panel4.Visible = false;
Panel5.Visible = false
}
}
}
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
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:
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;
}
//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;
}
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,
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);
}
File Name:Display.aspx
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
File Name:Department.aspx
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";
}
}
}
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
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;
}
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)
{
}
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,
HINT:
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 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>
<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;
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
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