Professional Documents
Culture Documents
1
Table of Contents
Page no.
1. Course details
Course objective (s) 03
Pre-requisites 03
Learning Outcomes 03
Course Outcomes 04
2. List of Experiments 06
3. Experimental Setup details for the course.
4. Experiment details 08
5. Guidelines for continuous assessment 35
Format for continuous assessment
Format for internal end semester assessment
COURSE DETAILS
Course Objective(s)
Students will gain the ability to implement the algorithms in C#.net, VB.net and ASP.net.
Pre-requisite
Programming experience of ‘.NET Technologies’ (BCSP 701)
4. Query textbox and Displaying records & Display records by using database
LIST OF EXPERIMENTS
Topic
Sr No.
Simple application using web controls
a) Finding factorial Value
b) Money Conversion
1 c) Quadratic Equation
d) Temperature Conversion
e) Login control
Experiment No:1(a)
Title
Write a Program to generate the factorial operation.
Objective
To calculate factorial of number
Dim i As Integer
Dim a As Double
Dim f As Double f = 1
i=1
a = TextBox1.Text
While i <= a
f=f*ii=i+1
End While
Label3.Text = f & "unit"
End Sub
End Class
Sample output
Experiment No:1(b)
Title Write a Program to perform Money Conversion.
Objective To convert money from one currency to another.
Algorithm Partial Class _Default
Inherits System.Web.UI.Page
Dim a As Double
a = TextBox1.Text
If DropDownList1.SelectedItem.Value = "Rupees" And
DropDownList2.SelectedItem.Value = "Doller" Then
Label5.Text = a * 45 & "$"
ElseIf DropDownList1.SelectedItem.Value = "Rupees" And
DropDownList2.SelectedItem.Value = "Zen" Then
Label5.Text = a * 43 & "Z"
ElseIf DropDownList1.SelectedItem.Value = "Rupees" And
DropDownList2.SelectedItem.Value = "Yen" Then
Label5.Text = a * 42 & "Y"
ElseIf DropDownList1.SelectedItem.Value = "Doller" And
DropDownList2.SelectedItem.Value = "Rupees" Then
Label5.Text = a * 33 & "R"
ElseIf DropDownList1.SelectedItem.Value = "Doller" And
DropDownList2.SelectedItem.Value = "Zen" Then
Label5.Text = a * 32 & "Z"
ElseIf DropDownList1.SelectedItem.Value = "Doller" And
DropDownList2.SelectedItem.Value = "Yen" Then
Label5.Text = a / 31 & "y"
ElseIf DropDownList1.SelectedItem.Value = "Zen" And
DropDownList2.SelectedItem.Value = "Rupees" Then
Label5.Text = a * 45 & "R"
ElseIf DropDownList1.SelectedItem.Value = "Zen" And
DropDownList2.SelectedItem.Value = "Doller" Then
Label5.Text = a * 46 & "$"
ElseIf DropDownList1.SelectedItem.Value = "Zen" And
DropDownList2.SelectedItem.Value = "Yen" Then
Label5.Text = a * 47 & "Y"
ElseIf DropDownList1.SelectedItem.Value = "Yen" And
DropDownList2.SelectedItem.Value = "Rupees" Then
Label5.Text = a / 34 & "R"
ElseIf DropDownList1.SelectedItem.Value = "Yen" And
DropDownList2.SelectedItem.Value = "Doller" Then
Label5.Text = a / 35 & "$"
ElseIf DropDownList1.SelectedItem.Value = "Yen" And
DropDownList2.SelectedItem.Value = "Zen" Then
Label5.Text = a / 36 & "Z"
Else : DropDownList1.SelectedItem.Value =
DropDownList2.SelectedItem.Value = "Zen"
MsgBox("You Select Same Currency")
End If
End Sub
End Class
Sample output
Experiment No:1(c)
Title Write a Program to generate the Quadratic Equation.
Objective To find out roots of a quadric equation.
Algorithm Partial
Class _Default
Inherits System.Web.UI.Page
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click Dim a As
Double
Dim b As Double Dim c
As Double Dim s As
Double Dim x1 As
Double Dim x2 As
Double a =
TextBox1.Text b =
TextBox2.Text c =
TextBox3.Text
s = Math.Sqrt(b *b - 4 * a * c) If (b * b - 4 * a
* c) = 0 Then Label5.Text = "Roots are Equal"
x1 = (-b + s) / 2 * a
x2 = (-b - s) / 2 * a Label6.Text ="The Roots : "
& x1
ElseIf (b * b - 4* a * c) < 0 Then Label5.Text ="The Roots
are Imaginary"
Else Label5.Text ="The Roots are Not Equal" x1 = (-b + s) / 2 *
a
x2 = (-b - s) / 2 * a
Label6.Text = "The Roots " & x1 & "or" & x2 End
IfEnd
Sub
Sample output
Experiment No:1(d)
Title Write a Program to generate the Temperature Conversion.
Objective To convert temperature from Fahrenheit to Celsius or vice versa
Algorithm Partial Class _Default
Inherits System.Web.UI.Page
Experiment No:1(e)
Title Write a Program to generate the Login control.
Objective To develop our own login control
Algorithm Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Login1_Authenticate(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.AuthenticateEventArgs) Handles Login1.Authenticate
If Login1.UserName = "Database" And Login1.Password = "Jaiswal" Then MsgBox("You are
successfully Logged in")
Else
MsgBox("Error:Loggedin")
End If
If Application("i") = 3 Then
MsgBox("You are Blocked")
Login1.Enabled = False
End If
End Sub
Global Application:
Sample output
After enter the wrong password
Experiment No:2
Title Write a Program to perform Asp.Net state.
Objective To convert temperature from Fahrenheit to Celsius or vice versa
Algortihm
Partial Class _Default
Inherits System.Web.UI.Page
Global Application:
<%@ Application Language="VB" %> <script runat="server">
Sub Application_End(ByVal sender As Object, ByVal e As EventArgs) ' Code that runs
on application shutdown
End Sub
</script>
Sampl
e
output
Experiment No:3
Title Write a Program to create an Advertisement using Ad rotator.
Objective To create an ad rotator
Algortihm
<?xml version="1.0" encoding="utf-8" ?>
<Advertisements>
<Ad>
<ImageUrl>.\image\p1.jpg</ImageUrl>
<NavigateUrl>www.pepsi.com</NavigateUrl>
<AlternativeText>Pepsi</AlternativeText>
<Keyword>softdrink</Keyword> <Impression>2</Impression>
</Ad> <Ad>
<ImageUrl>.\image\p2.jpg</ImageUrl> <NavigateUrl>www.Excel.com</NavigateUrl>
<AlternativeText>Excel</AlternativeText> <Keyword>softdrink</Keyword>
<Impression>2</Impression>
</Ad> <Ad>
<ImageUrl>.\image\p3.jpg</ImageUrl> <NavigateUrl>www.7up.com</NavigateUrl>
<AlternativeText>7up</AlternativeText> <Keyword>softdrink</Keyword>
<Impression>2</Impression>
</Ad> <Ad>
<ImageUrl>.\image\p4.jpg</ImageUrl> <NavigateUrl>www.Mirinda.com</NavigateUrl>
<AlternativeText>Mirinda</AlternativeText> <Keyword>softdrink</Keyword>
<Impression>2</Impression>
</Ad>
</Advertisements>
Sample
output
VIEW 1 VIEW 2
Experiment No:4(a)
Title Write a Program to display the Holiday in calendar.
Objective To display holiday in calender
Algortihm Partial Class _Default
Inherits System.Web.UI.Page
Dim Holidays(13, 32)
End Sub
End If
End If
End Sub
End Class
Sample
output
Experiment No:4(b)
Title Write a Program to display the vacation in calendar.
Objective To display the vacation in calendar
Algortihm Partial Class _Default
Inherits System.Web.UI.Page
Sample
output
Experiment No:4(c)
Title Write a Program to display the selected date in the calendar.
Objective To display the selected date in the calendar.
Algortihm Partial Class _Default
Inherits System.Web.UI.Page
Dim Holidays(13, 32)
Protected Sub Calendar3_DayRender(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DayRenderEventArgs) Handles Calendar3.DayRender
weekendstyle.BackColor = System.Drawing.Color.Green
If ((e.Day.Date >= Calendar1.SelectedDate) And (e.Day.Date <= Calendar2.SelectedDate))
Then
e.Cell.ApplyStyle(vacationstyle) ElseIf (e.Day.IsWeekend) Then
e.Cell.ApplyStyle(weekendstyle) End If
If e.Day.IsOtherMonth Then e.Cell.Controls.Clear()
Else
Dim aDate As Date = e.Day.Date
Dim aHolidays As String = Holidays(aDate.Month, aDate.Day) If (Not aHolidays Is Nothing)
Then
Dim alabel As Label = New Label() alabel.Text = "<br>" & aHolidays
e.Cell.Controls.Add(alabel)
End If
End If
End Sub
Experiment No:4(d)
Title Write a Program to display the Difference between the two dates in the
calendar.
Objective To display the Difference between the two dates in the calendar.
Algortihm Imports system.data.sqlclient
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Button1.Click
Dim y As Double = a / 365 Label1.Text = floor(y) & "YEARS" Dim x As Double= a mode 365
Dim m As Integer = x / 31 Label2.Text =floor(m) & "MONTHS"
Dim d As Integer = x mode 31
Label3.Text = floor(d) & "DAYS"
Else
MsgBox("Invalid date")
End If
End Sub
End Class
Sample
output
Experiment No:5(a)
Title Write a Program to perform Tree view operation using data list.
Objective To perform Tree view operation using data list.
Algortihm Partial Class _Default
Inherits System.Web.UI.Page
End Sub
Sample
output
Experiment No:5(b)
Title Write a Program to perform Tree view operation.
Objective To perform Tree view operation.
Algortihm Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles
Me.Load
End Sub
Experiment No:6
Title Write a Program to perform validation operation.
Objective To perform validation operation.
Algortihm Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Button1.Click
If IsValid Then
Label9.Enabled = False
TextBox7.Enabled = False
End If
Sample
output
Experiment No:7
Title Write a Program to bind data in a multiline textbox by querying in
another textbox.
Objective To bind data in a multiline textbox by querying in another textbox.
Algortihm
Imports System.Data
Imports System.Data.SqlClient
End Sub
End Class
Sample
output
Experiment No:8
Title Write a Program to display the phone no of an author using database.
Objective To display the phone no of an author using database.
Algortihm
Imports System.Data.SqlClient
Partial Class _Default
Inherits System.Web.UI.Page
Dim constr As String =
ConfigurationManager.ConnectionStrings("DatabaseConnectionString1").Connection String
Au_lname=@Au_lname"
cmdselect.Parameters.Add("@Au_fname", Au_fname.Text)
cmdselect.Parameters.Add("@Au_lname", Au_lname.Text)
conpubs.Open()
label5.Text = cmdselect.ExecuteScalar()
conpubs.Close() End Sub
End Class
Sample
output
Experiment No:9
Title Write a Program to create link in data list.
Objective To create link in data list.
Algortihm Imports System.Data.SqlClient
Partial Class _Default
Inherits System.Web.UI.Page
Dim constr As String =
ConfigurationManager.ConnectionStrings("DatabaseConnectionString1").Connection String
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load
If Not IsPostBack Then
BindDataList()
End If
End Sub
Sub BindDatalist()
End Sub
Protected Sub dtrlstAuthor_ItemCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataListCommandEventArgs) Handles
dtrlstAuthor.ItemCommand
dtrlstAuthor.SelectedIndex = e.Item.ItemIndex
BindDatalist()
End Sub
End Class
Sample
output
Experiment No:10
Title Write a Program to display how data bind using dropdown list.
Objective To display how data bind using dropdown list.
Algortihm Imports System.Data.SqlClient
Partial Class _Default
Inherits System.Web.UI.Page
Dim constr As String =
ConfigurationManager.ConnectionStrings("DatabaseConnectionString1").Connection String
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Button1.Click
Label1.Text = "you pick" & DropDownList1.SelectedValue
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles
Me.Load
If Not IsPostBack Then
Dim conpubs As SqlConnection
Dim cmdselect As SqlCommand
Dim dtrAuthor As SqlDataReader
conpubs = New SqlConnection(constr)
cmdselect = New SqlCommand("select Au_fname from Author",
conpubs) conpubs.Open()
dtrAuthor = cmdselect.ExecuteReader()
DropDownList1.DataSource = dtrAuthor
DropDownList1.DataTextField = "Au_fname"
DropDownList1.DataBind()
dtrAuthor.Close()
conpubs.Close()
End If
End Sub
End Class
Sample
output
Experiment No:11
Title Write a Program to insert the data in to database using Execute-Non
Query.
Objective To insert the data in to database using Execute-Non Query.
Algortihm Imports System.Data.SqlClient
Partial Class _Default
Inherits System.Web.UI.Page
Dim constr As String =
ConfigurationManager.ConnectionStrings("DatabaseConnectionString1").Connection String
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Button1.Click
Dim conpubs As SqlConnection Dim strInsert As String
Dim cmdInsert As SqlCommand
conpubs = New SqlConnection(constr)
strInsert = "Insert Author(Au_fname,Au_lname)values(@Au_fname,@Au_lname)"
cmdInsert = New SqlCommand(strInsert, conpubs) cmdInsert.Parameters.Add("@Au_fname",
txtfname.Text) cmdInsert.Parameters.Add("@Au_lname", txtlname.Text) conpubs.Open()
cmdInsert.ExecuteNonQuery()
conpubs.Close()
Response.Write(”New Rowinserted”) End Sub
End Class
Sample
output
Experiment No:12
Title Write a Program to delete the data in to database using Execute non-
query.
End Class
Sample
output
Experiment No:13
Title Write a Program to bind data using data list.
Objective To bind data using data list.
Algortihm Imports System.Data.SqlClient
End Class
Sample
output
Experiment No:14
Title Write a Program to bind data using template in data list.
Objective To bind data using template in data list.
Algortihm Imports System.Data.SqlClient
Partial Class _Default
Inherits System.Web.UI.Page
Dim constr As String =
ConfigurationManager.ConnectionStrings("DatabaseConnectionString1").Connection String
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load
Dim conpubs As SqlConnection Dim cmdselect As SqlCommand Dim dtrAuthor As
SqlDataReader
conpubs = New SqlConnection(constr)
cmdselect = New SqlCommand("Select * from Author", conpubs) conpubs.Open()
dtrAuthor = cmdselect.ExecuteReader() dtrlstAuthor.DataSource = dtrAuthor
dtrlstAuthor.DataBind() dtrAuthor.Close()
conpubs.Close() End Sub
End Class
Sample
output
Experiment No:15
Title Write a Program to bind data using data grid.
Objective To bind data using data grid.
Algortihm Imports System.Data.SqlClient
Sample
output
Experiment No:16
Title Write a Program to bind data using template column in data grid.
Objective To bind data using template column in data grid.
Algortihm Imports System.Data.SqlClient
Partial Class _Default
Inherits System.Web.UI.Page
Dim constr As String =
ConfigurationManager.ConnectionStrings("DAtabaseConnectionString1").Connection String
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles
Me.Load
Dim conpubs As SqlConnection Dim cmdselect As SqlCommand
conpubs = New SqlConnection(constr)
cmdselect = New SqlCommand("select * from Author", conpubs) conpubs.Open()
datagrd.DataSource = cmdselect.ExecuteReader() datagrd.DataBind()
conpubs.Close()
End Sub
End Class
Sample
output
Experiment No:17
Title Write a Program to bind data using Hyperlink column in data grid.
Objective To bind data using Hyperlink column in data grid.
Algortihm
Imports System.Data.SqlClient
Partial Class _Default
Inherits System.Web.UI.Page
conpubs.Open()
datagrdlnk.DataSource = cmdselect.ExecuteReader()
datagrdlnk.DataBind()
conpubs.Close()
End Sub
End Class
Sample
output
Experiment No:18
Title Write a Program to bind data using button column in data grid.
Objective To bind data using button column in data grid.
Algortihm Imports System.Data.SqlClient
Partial Class _Default
Inherits System.Web.UI.Page
Dim constr As String =
ConfigurationManager.ConnectionStrings("DatabaseConnectionString1").Connection String
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load
If Not IsPostBack Then
Dim conpubs As SqlConnection Dim cmdselect As SqlCommand
conpubs = New SqlConnection(constr)
cmdselect = New SqlCommand("select * from Author", conpubs) conpubs.Open()
GridView1.DataSource = cmdselect.ExecuteReader() GridView1.DataBind()
conpubs.Close() End If
End Sub
Protected Sub GridView1_RowCommand(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.GridViewCommandEventArgs) Handles
GridView1.RowCommand
If e.CommandName = "select" Then GridView1.SelectedRowStyle.BackColor =
Drawing.Color.Green
Else
GridView1.SelectedRowStyle.BackColor = Drawing.Color.White
End If
End Sub
End Class
Experiment No:19
Title Write a Program to create link using event in data list.
Objective To create link using event in data list.
Algortihm Imports System.Data.SqlClient
Partial Class _Default
Inherits System.Web.UI.Page
Dim constr As String =
ConfigurationManager.ConnectionStrings("RajeevConnectionString1").ConnectionSt ring
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles
Me.Load
If Not IsPostBack Then
Dim conpubs As SqlConnection
Dim cmdselect As SqlCommand
Dim dtrAuthor As SqlDataReader
conpubs = New SqlConnection(constr)
cmdselect = New SqlCommand("Select * from Author", conpubs)
conpubs.Open()
dtrAuthor = cmdselect.ExecuteReader()
dtrlstAuthor.DataSource = dtrAuthor
dtrlstAuthor.DataBind()
dtrAuthor.Close()
conpubs.Close()
End If
End Sub
Protected Sub dtrlstAuthor_CancelCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataListCommandEventArgs) Handles
dtrlstAuthor.CancelCommand
lb1Message.Text = "<li> Cancel Item!"
End Sub
Protected Sub dtrlstAuthor_DeleteCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataListCommandEventArgs) Handles
dtrlstAuthor.DeleteCommand
lb1Message.Text = "<li> Delete Item!"
End Sub
Protected Sub dtrlstAuthor_EditCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataListCommandEventArgs) Handles
dtrlstAuthor.EditCommand
lb1Message.Text &= "<li> Edit item!"
End Sub
Protected Sub dtrlstAuthor_ItemCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataListCommandEventArgs) Handles
dtrlstAuthor.ItemCommand
lb1Message.Text = "<li> Item command!"
End Sub
Protected Sub dtrlstAuthor_UpdateCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataListCommandEventArgs) Handles
dtrlstAuthor.UpdateCommand
lb1Message.Text = "<li> Update Item!"
End Sub
End Class
Sample
output
Experiment No:20
Title Write a Program to implement paging concept data grid and dataset.
Objective To implement paging concept data grid and dataset.
Algortihm
Imports System.Data
Imports System.Data.SqlClient
Partial Class _Default
Inherits System.Web.UI.Page
Dim constr As String =
ConfigurationManager.ConnectionStrings("DatabaseConnectionString1").Connection String
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load
If Not IsPostBack Then
Binddatagrid()
End If
End Sub
Sub Binddatagrid()
Dim conpubs As SqlConnection Dim dtrtitle As SqlDataAdapter Dim datset As DataSet
conpubs = New SqlConnection(constr)
dtrtitle = New SqlDataAdapter("select * from Author", conpubs) datset = New DataSet
dtrtitle.Fill(datset) GridView1.DataSource = datset GridView1.DataBind()
End Sub
Protected Sub GridView1_PageIndexChanged(ByVal sender As Object, ByVal e As
System.EventArgs) Handles GridView1.PageIndexChanged
End Sub
Protected Sub GridView1_PageIndexChanging(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.GridViewPageEventArgs) Handles
GridView1.PageIndexChanging
GridView1.PageIndex = e.NewPageIndex
Binddatagrid()
End Sub
Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As
System.EventArgs) Handles GridView1.SelectedIndexChanged
End Sub
End Class
Sample
output
After click on second page
Experiment No:21
Title Write a Program create an own table and bind data using data grid.
Objective create an own table and bind data using data grid.
Algortihm Imports System.Data
Partial Class _Default
Inherits System.Web.UI.Page
Function CreateDatasource() As ICollection
Dim dt As New DataTable()
Dim dr As DataRow
dt.Columns.Add(New DataColumn("integervalue", GetType(Int32))) dt.Columns.Add(New
DataColumn("stringvalue", GetType(String)))
dt.Columns.Add(New DataColumn("currencyvalue", GetType(Double)))
Dim i As Integer
For i = 0 To 8
dr = dt.NewRow() dr(0) = i
dr(1) = "item" + i.ToString dr(2) = 1.23 * (i + 1) dt.Rows.Add(dr)
Next i
Dim dv As New DataView(dt) Return dv
End Function
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles
Me.Load
If Not IsPostBack Then
GridView1.DataSource = CreateDatasource()
GridView1.DataBind()
End If
End Sub
End Class
Sample
output
9
8
7
6
5
4
3
2
1
15
14
13
12
11
10
S No.
Name
Enroll No.
Date of Experiment ->
Viva/File(5)
Viva/File(5)
Viva/File(5)
Viva/File(5)
Viva/File(5)
16
17
18
19
20
21
22
23
24
25
S No. Enroll no. Name Lab file Attendance Quiz Viva Program with Total
(10) (10) (10) (10) execution(10) (50)