0% found this document useful (0 votes)
155 views36 pages

Datalist Control in ASP.NET Lab Guide

This document provides details about a .NET Technologies lab manual, including: - The course objectives are for students to gain the ability to implement algorithms in C#.NET, VB.NET and ASP.NET. - The learning outcomes include being able to create simple applications using web controls, work with ASP.NET pages and controls, perform queries and database operations using ADO.NET, and bind data to different ASP.NET controls. - The syllabus covers topics in C#, VB.NET, ASP.NET, databases, and programming concepts implemented across multiple units.

Uploaded by

Munyaradzi Zhou
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
155 views36 pages

Datalist Control in ASP.NET Lab Guide

This document provides details about a .NET Technologies lab manual, including: - The course objectives are for students to gain the ability to implement algorithms in C#.NET, VB.NET and ASP.NET. - The learning outcomes include being able to create simple applications using web controls, work with ASP.NET pages and controls, perform queries and database operations using ADO.NET, and bind data to different ASP.NET controls. - The syllabus covers topics in C#, VB.NET, ASP.NET, databases, and programming concepts implemented across multiple units.

Uploaded by

Munyaradzi Zhou
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

LAB MANUAL

.NET TECHNOLOGIES LAB


BCA-303

School of Computing Science & Engineering


Version : 1 Date: 14/10/2013 Drafted by : Gurpreet Singh

1
Table of Contents

Page no.
1. Course details
1.1. Course objective (s) 03
1.2. Pre-requisites 03
1.3. Learning Outcomes 03
1.4. Syllabus & References 04
2. List of Experiments 06
3. Experimental Setup details for the course.
4. Experiment details 08
5. Guidelines for continuous assessment 35
5.1. Format for continuous assessment
5.2. Format for internal end semester assessment

2
COURSE DETAILS

Course Objective(s)
Students will gain the ability to implement the algorithms in C#.net, [Link] and [Link].
Pre-requisite
1. Programming experience of ‘.NET Technologies’ (BCA-303)

Learning Out come


At the end of the course student will be able to:

1. Create Simple application using web controls

2. Work with States of [Link] Pages & Adrotator Control

3. Use of calendar control, Treeview control & Validation controls

4. Query textbox and Displaying records & Display records by using database

5. Datalist link control & Databinding using dropdownlist control

6. Inserting record into a database & Deleting record into a database

7. Databinding using datalist control & Datalist control templates

8. Databinding using datagrid & Datagrid control template

9. Datagrid hyperlink & Datagrid button column

10. Datalist event & Datagrid paging

11. Creating own table format using datagrid

Syllabus & References

Unit I: Introduction 9 lecture hours

Introducing C#, Understanding .NET, Overview of C#, Literals, Variables, Data Types, Operators,
Expressions, Branching, Looping, Methods, Arrays, Strings, Structures, Enumerations, Classes,
Objects, Inheritance, Polymorphism, Interfaces, Operator Overloading, Delegates, Events, Errors

3
and Exceptions, Defining classes and class members. Assembly, Components of Assembly, Private
and Shared Assembly, Garbage Collector, JIT compiler. Namespaces Collections, Comparisons
and Conversions, Delegates and Events.

Unit II:C# 7 lecture hours

Getting Started with .Net Framework, Exploring Visual Studio .NET, Inside a C# Program, Data
Types, Statements, Arrays, Using Strings, Objects, Classes and Structs, Properties, Inheritance,
Indexers, Delegates, Events, Namespaces, Generics, Collections and Data Structures, Exception
Handling, Threading, Using Streams and Files, Reflection, Assemblies, versioning, Windows
Forms, Controls, Data binding to Conrols, Advanced Database Programming using [Link],
Using GDI +,Networking,.net Remoting, Manipulating XML.

Unit III: [Link] 8 lecture hours

Creating Applications with Visual [Link], Variables, Constants, and Calculations, Making
Decisions and Working with Strings, Lists, Loops, Validation, Sub Procedures and Functions,
Multiple Forms, Standard Modules, and Menus, Arrays, Timers, Form Controls, File Handling,
Exception Handling, Working with Databases, Advanced Database Programming using [Link],
Classes, Generics, Collections, Inheritance, Custom Controls, Packaging & deployment, Using
Crystal Reports.

Unit IV: [Link] 9 lecture hours

Building a Web Application, Examples Using Standard Controls, Using HTML Controls,
Validating Form Input Controls using Validation Controls, Understanding Applications and State,
Applying Styles, Themes, and Skins, Creating a Layout Using Master Pages, Binding to Databases
using Controls, Data Management with [Link], Creating a Site Navigation Hierarchy,
Navigation Controls , Membership and Role Management, Login Controls, Securing Applications,
Caching For Performance, Working with XML, Using Crystal Reports in Web Forms.

Unit V: DBMS 8 lecture hours

Databases: Introduction, Using SQL to work with database, retrieving and manipulating data with
SQL, working with [Link], [Link] architecture, [Link] data control, data source
control, deploying the web site. Crystal reports. LINQ: Operators, implementations, LINQ to
objects, XML, [Link], Query Syntax.

Reference Books
1. Visual studio 2010 - A beginners guide - Joseph Mayo
3. Jeffrey R. Shapiro “The Complete Reference Visual Basic .NET” Tata Mcgraw Hill (2002
Edition).
4. Pro [Link] 4 in C# 2010, MacDonald and Freeman
5. Visual Studio 2010 and .NET 4 Six-in-One (Wrox Programmer to Programmer)

4
Mode of Evaluation: Quiz/Assignment/ Seminar/Written Examination

Theory Laboratory Theory and


laboratory
Components Internal SEE Internal SEE
Marks 50 50 50 50
Total Marks 100 100
Scaled Marks 75 25 100

Relationship between the Course Outcomes (COs) and Program Outcomes (POs)

Mapping between Cos and Pos


Sl. No. Course Outcomes (COs) Mapped
Program
Outcomes
1 Create Simple application using web controls 1
2 Work with States of [Link] Pages & Adrotator Control 1,3
Use of calendar control, Treeview control & Validation controls
3 Query textbox and Displaying records & Display records by using database 3,5,9
Datalist link control & Databinding using dropdownlist control
Inserting record into a database & Deleting record into a database
4 Databinding using datalist control & Datalist control templates 3,5,9,11
Databinding using datagrid & Datagrid control template
Datagrid hyperlink & Datagrid button column
Datalist event & Datagrid paging
Creating own table format using datagrid
Design/development

Project management

Life-long Learning
Modern tool usage
complex problems

Individual or team
The engineer and

Environment and
Problem analysis

investigations of

Communication

Program
sustainability
Engineering

of solutions

and finance
Knowledge

Outcome→
Conduct

society

Ethics

work

Course
Course Name 1 2 3 4 5 6 7 8 9 10 11 12
Code

.NET 3
CSE303 2 2 2 1
Technologies 3

1=addressed to small extent


2= addressed significantly
3=major part of course
5
Course Lab Outcomes Assessment
The laboratory component strongly contributes towards the program outcome
Design/development of solutions-PO(3). This evaluation method will be used for the evaluation
of lab and program outcomes of this course.
Direct Measurement Report
CSE311P Outcome (3) Report Form
Measure– percent of students scoring at least 70% marks in lab.
Target – 70% of students

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

States of [Link] Pages


2
Adrotator Control
3
Calendar control
a) Display messages in a calendar control
4 b) Display vacation in a calendar control
c) Selected day in a calendar control using style
d) Difference between two calendar dates
Treeview control
5 a) Treeview control and datalist
b) Treeview operations
Validation controls
6
Query textbox and Displaying records
7
Display records by using database
8

6
Datalist link control
9
Databinding using dropdownlist control
10
Inserting record into a database
11
Deleting record into a database
12
Databinding using datalist control
13
Datalist control templates
14
Databinding using datagrid
15
Datagrid control template
16
Datagrid hyperlink
17
Datagrid button column
18
Datalist event
19
Datagrid paging
20

21 Creating own table format using datagrid

EXPERIMENTAL SETUP DETAILS FOR THE COURSE


Software Requirements
Microsoft Visual Studio 2010, Asp .net Framework 2.0/ 3.0/3.5/4.0
Microsoft SQL Express 2005 database engine.
Hardware Requirements
No specific requirements. Any computer Hardware capable of running DOS can be
used for this course.

7
EXPERIMENT DETAILS

Experiment No:1(a)
Title
Write a Program to generate the factorial operation.
Objective
To calculate factorial of number

Algorithm Partial Class _Default


Inherits [Link]
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As [Link])
Handles [Link]

Dim i As Integer
Dim a As Double
Dim f As Double f = 1
i=1
a = [Link]
While i <= a
f=f*ii=i+1
End While
[Link] = f & "unit"
End Sub

End Class

Sample output

8
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 [Link]

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As [Link])


Handles [Link]

Dim a As Double
a = [Link]
If [Link] = "Rupees" And
[Link] = "Doller" Then
[Link] = a * 45 & "$"
ElseIf [Link] = "Rupees" And
[Link] = "Zen" Then
[Link] = a * 43 & "Z"
ElseIf [Link] = "Rupees" And
[Link] = "Yen" Then
[Link] = a * 42 & "Y"
ElseIf [Link] = "Doller" And
[Link] = "Rupees" Then
[Link] = a * 33 & "R"
ElseIf [Link] = "Doller" And
[Link] = "Zen" Then
[Link] = a * 32 & "Z"
ElseIf [Link] = "Doller" And
[Link] = "Yen" Then
[Link] = a / 31 & "y"
ElseIf [Link] = "Zen" And
[Link] = "Rupees" Then
[Link] = a * 45 & "R"
ElseIf [Link] = "Zen" And
[Link] = "Doller" Then
[Link] = a * 46 & "$"
ElseIf [Link] = "Zen" And
[Link] = "Yen" Then
[Link] = a * 47 & "Y"
ElseIf [Link] = "Yen" And
[Link] = "Rupees" Then
[Link] = a / 34 & "R"
ElseIf [Link] = "Yen" And
[Link] = "Doller" Then
[Link] = a / 35 & "$"
ElseIf [Link] = "Yen" And
[Link] = "Zen" Then
[Link] = a / 36 & "Z"
Else : [Link] =
[Link] = "Zen"
MsgBox("You Select Same Currency")
End If
End Sub
End Class

9
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 [Link]
Protected Sub Button1_Click(ByVal sender As Object, ByVal e
As
[Link]) Handles [Link]
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 = [Link]
b = [Link]
c = [Link]
s = [Link](b *b - 4 * a * c)
If (b * b - 4 * a * c) = 0 Then
[Link] = "Roots are Equal"
x1 = (-b + s) / 2 * a
x2 = (-b - s) / 2 * a
[Link] ="The Roots : " & x1
ElseIf (b * b - 4* a * c) < 0 Then
[Link] ="The Roots are Imaginary"
Else [Link] ="The Roots are Not Equal"
x1 = (-b + s) / 2 * a
x2 = (-b - s) / 2 * a

10
[Link] = "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 [Link]

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As [Link])


Handles [Link]
Dim a As Double
Dim f As Double
Dim c As Double
a = [Link]
If [Link] Then c = (a - 32) * 5 / 9 [Link] = c & "f"
ElseIf [Link] Then f = (a * 9 / 5) + 32 [Link] = f & "c"
Else
MsgBox("Select one Option") End If
End Sub End class

11
Sample output

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 [Link]
Protected Sub Login1_Authenticate(ByVal sender As Object, ByVal e As
[Link]) Handles [Link]
If [Link] = "Database" And [Link] = "Jaiswal" Then MsgBox("You are
successfully Logged in")
Else
MsgBox("Error:Loggedin")
End If
If Application("i") = 3 Then
MsgBox("You are Blocked")
[Link] = False
End If
End Sub

Protected Sub Page_Load(ByVal sender As Object, ByVal e As [Link]) Handles


[Link]
Application("i") = Int(Application("i") + 1)
If Application("i") > 3 Then
Application("i") = 0
End If
End Sub
End Class

Global Application:

<%@ Application Language="VB" %> <script runat="server">


Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
Application("i") = 0
End Sub

12
Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
End Sub

Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)


End Sub

Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)


End Sub

Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)


End Sub
</script>

Sample output
After enter the wrong password

After log in three times the login will be blocked

Experiment No:2
Title Write a Program to perform [Link] state.
Objective To convert temperature from Fahrenheit to Celsius or vice versa
Algortihm
Partial Class _Default

Inherits [Link]

Protected Sub Page_Load(ByVal sender As Object, ByVal e As [Link]) Handles


[Link]
Application("visits") = Int(Application("visits") + 1)
[Link] = Application("visits")
[Link] = Session("My text").ToString
End Sub

13
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As [Link])
Handles [Link]
Dim txt As String = [Link]
[Link]("Item", txt)
Dim Item As String = ViewState("Item").ToString
[Link] = Item
End Sub
End Class

Global Application:
<%@ Application Language="VB" %> <script runat="server">

Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs) ' Code that runs
on application startup
Application("visits") = 0
End Sub

Sub Application_End(ByVal sender As Object, ByVal e As EventArgs) ' Code that runs on
application shutdown
End Sub

Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)


Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)

Session("My text") = "I am the user"


End Sub

Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)


mode
End Sub

</script>

Sample
output

14
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\[Link]</ImageUrl>
<NavigateUrl>[Link]</NavigateUrl>
<AlternativeText>Pepsi</AlternativeText>
<Keyword>softdrink</Keyword> <Impression>2</Impression>
</Ad> <Ad>

<ImageUrl>.\image\[Link]</ImageUrl> <NavigateUrl>[Link]</NavigateUrl>
<AlternativeText>Excel</AlternativeText> <Keyword>softdrink</Keyword>
<Impression>2</Impression>

</Ad> <Ad>

<ImageUrl>.\image\[Link]</ImageUrl> <NavigateUrl>[Link]</NavigateUrl>
<AlternativeText>7up</AlternativeText> <Keyword>softdrink</Keyword>
<Impression>2</Impression>

</Ad> <Ad>

<ImageUrl>.\image\[Link]</ImageUrl> <NavigateUrl>[Link]</NavigateUrl>
<AlternativeText>Mirinda</AlternativeText> <Keyword>softdrink</Keyword>
<Impression>2</Impression>

</Ad>
</Advertisements>

Sample
output

VIEW 1 VIEW 2

15
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 [Link]
Dim Holidays(13, 32)

Protected Sub Page_Load(ByVal sender As Object, ByVal e As [Link]) Handles


[Link]

Holidays(10, 12) = "Birthdays"


Holidays(10, 15) = "Aniversary"

End Sub

Protected Sub Calendar1_DayRender(ByVal sender As Object, ByVal e As


[Link]) Handles [Link]
If [Link] Then [Link]()
Else
Dim adate As Date = [Link]
Dim aHolidays As String = Holidays([Link], [Link]) If (Not aHolidays Is Nothing)
Then
Dim alabel As New Label() [Link] = "<br>" & aHolidays [Link](alabel)

End If
End If
End Sub
End Class

Sample
output

16
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 [Link]

Protected Sub Calendar1_DayRender(ByVal sender As Object, ByVal e As


[Link]) Handles [Link]

Dim vocationstyle As New Style()


With vocationstyle
.BackColor = [Link]
.BorderColor = [Link]
.BorderWidth = New Unit(3)
End With
Dim weekendstyle As New Style()
[Link] = [Link]
If (([Link] >= New Date(2009, 11, 23)) And ([Link] <= New Date(2009, 11, 30)))
Then
[Link](vocationstyle) ElseIf ([Link]) Then
[Link](weekendstyle) End If
End Sub

Sample
output

17
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 [Link]
Dim Holidays(13, 32)
Protected Sub Calendar3_DayRender(ByVal sender As Object, ByVal e As
[Link]) Handles [Link]

Dim vacationstyle As New Style()


With vacationstyle
.BackColor = [Link]
.BorderColor = [Link]
.BorderWidth = New Unit(3)
End With
Dim weekendstyle As New Style()

[Link] = [Link]
If (([Link] >= [Link]) And ([Link] <= [Link]))
Then
[Link](vacationstyle) ElseIf ([Link]) Then
[Link](weekendstyle) End If
If [Link] Then [Link]()
Else
Dim aDate As Date = [Link]
Dim aHolidays As String = Holidays([Link], [Link]) If (Not aHolidays Is Nothing)
Then
Dim alabel As Label = New Label() [Link] = "<br>" & aHolidays
[Link](alabel)
End If
End If
End Sub

Protected Sub Page_Load(ByVal sender As Object, ByVal e As [Link]) Handles


[Link]
Holidays(8, 15) = "IndependenceDay"
Holidays(1, 26) = "RepublicDay"
Holidays(10, 12) = "Birthday"
End Sub

Protected Sub Calendar1_SelectionChanged(ByVal sender As Object, ByVal e As


[Link]) Handles [Link]
[Link] = [Link]
End Sub

Protected Sub Calendar2_SelectionChanged(ByVal sender As Object, ByVal e As


[Link]) Handles [Link]
[Link] = [Link]
End Sub
End Class

18
Sample
output

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 [Link]
Partial Class _Default
Inherits [Link]
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As [Link])
Handles [Link]

If floor([Link] > [Link])


Then
Dim a As double = [Link]([Link] - [Link]).TotalDays

Dim y As Double = a / 365 [Link] = floor(y) & "YEARS" Dim x As Double= a mode 365
Dim m As Integer = x / 31 [Link] =floor(m) & "MONTHS"
Dim d As Integer = x mode 31
[Link] = floor(d) & "DAYS"

Else

MsgBox("Invalid date")

End If
End Sub
End Class

19
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 [Link]

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As [Link])


Handles [Link]

Dim checkednodes As TreeNodeCollection = [Link]


[Link] = checkednodes
[Link]()

End Sub

Sample
output

20
Experiment No:5(b)
Title Write a Program to perform Tree view operation.
Objective To perform Tree view operation.
Algortihm Partial Class _Default
Inherits [Link]
Protected Sub Page_Load(ByVal sender As Object, ByVal e As [Link]) Handles
[Link]
End Sub

Protected Sub TreeView1_SelectedNodeChanged(ByVal sender As Object, ByVal e As


[Link]) Handles [Link]
Dim value As String = [Link]
Dim path As String = [Link]
[Link]("The value select was" & value & "<br>")
[Link]("The value path is " & value & "<br>")
End Sub

Protected Sub TreeView1_TreeNodeCheckChanged(ByVal sender As Object, ByVal e As


[Link]) Handles
[Link]
Dim value As String = [Link]
[Link]("The value collapsed was" & value & "<br>")
End Sub
Protected Sub TreeView1_TreeNodeExpanded(ByVal sender As Object, ByVal e As
[Link]) Handles [Link]
Dim value As String = [Link]
[Link]("The value collapsed was" & value & "<br>")
End Sub
End Class
Sample
output

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 [Link])
Handles [Link]
If IsValid Then
[Link] = False
[Link] = False
End If

21
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 [Link]
Imports [Link]

Partial Class _Default


Inherits [Link]

Dim constr As String =


[Link]("DatabaseConnectionString1").Connection String

Protected Sub Button_Click(ByVal sender As Object, ByVal e As [Link]) Handles


[Link]
Dim conPubs As SqlConnection Dim cmdSelect As SqlCommand
Dim dtrResults As SqlDataReader Dim intField As Integer
conpubs = New SqlConnection(constr)
[Link]()

cmdSelect = New SqlCommand([Link], conPubs) dtrResults =


[Link]() [Link]=""

22
While [Link]() [Link] &=vbNewLine

For intField = 0 To [Link] - 1


[Link] &= dtrResults(intField).ToString().PadRight(15)
Next
End While
[Link]()
[Link]()

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 [Link]
Partial Class _Default
Inherits [Link]
Dim constr As String =
[Link]("DatabaseConnectionString1").Connection String

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As [Link])


Handles [Link]
Dim conpubs As SqlConnection
Dim strselect As String
Dim cmdselect As SqlCommand
conpubs = New SqlConnection(constr)

23
strselect = "select phone from Author where Au_fname=@Au_fname And

Au_lname=@Au_lname"

cmdselect = New SqlCommand(strselect, conpubs)

[Link]("@Au_fname", Au_fname.Text)

[Link]("@Au_lname", Au_lname.Text)

[Link]()
[Link] = [Link]() [Link]()
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 [Link]
Partial Class _Default
Inherits [Link]
Dim constr As String =
[Link]("DatabaseConnectionString1").Connection String
Protected Sub Page_Load(ByVal sender As Object, ByVal e As [Link]) Handles
[Link]
If Not IsPostBack Then
BindDataList()
End If
End Sub

24
Sub BindDatalist()

Dim conpubs As SqlConnection Dim cmdselect As SqlCommand Dim dtrAuthor As


SqlDataReader
conpubs = New SqlConnection(constr) [Link]()
cmdselect = New SqlCommand("Select * from Author", conpubs) dtrAuthor =
[Link]() [Link] = dtrAuthor
[Link]()
[Link]()
[Link]()

End Sub
Protected Sub dtrlstAuthor_ItemCommand(ByVal source As Object, ByVal e As
[Link]) Handles
[Link]
[Link] = [Link]
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 [Link]
Partial Class _Default
Inherits [Link]
Dim constr As String =
[Link]("DatabaseConnectionString1").Connection String
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As [Link])
Handles [Link]
[Link] = "you pick" & [Link]
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As [Link]) Handles
[Link]
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)
[Link]()
dtrAuthor = [Link]()
[Link] = dtrAuthor
[Link] = "Au_fname"

25
[Link]()
[Link]()
[Link]()
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 [Link]
Partial Class _Default
Inherits [Link]
Dim constr As String =
[Link]("DatabaseConnectionString1").Connection String
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As [Link])
Handles [Link]
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) [Link]("@Au_fname",
[Link]) [Link]("@Au_lname", [Link]) [Link]()
[Link]()
[Link]()
[Link](”New Rowinserted”) End Sub
End Class
Sample
output

26
Experiment No:12
Title Write a Program to delete the data in to database using Execute non-
query.

Objective To delete the data in to database using Execute non-query.


Algortihm Imports [Link]
Partial Class _Default
Inherits [Link]
Dim constr As String =
[Link]("RajeevConnectionString1").ConnectionSt ring
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As [Link])
Handles [Link]
Dim conpubs As SqlConnection Dim strdelete As String
Dim cmddelete As SqlCommand
conpubs = New SqlConnection(constr)
strdelete = "delete from Author where Au_fname=@Au_fname" cmddelete = New
SqlCommand(strdelete, conpubs) [Link]("@Au_fname", [Link])
[Link]()
[Link]() [Link]("Row delete") [Link]()
End Sub

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 [Link]

Partial Class _Default


Inherits [Link]
Dim constr As String =
[Link]("DatabaseConnectionString1").Connection String
Protected Sub Page_Load(ByVal sender As Object, ByVal e As [Link]) Handles
[Link]
Dim conpubs As SqlConnection Dim cmdselect As SqlCommand Dim dtrAuthor As

27
SqlDataReader
conpubs = New SqlConnection(constr)
cmdselect = New SqlCommand("Select Au_fname from Author", conpubs) [Link]()
dtrAuthor = [Link]() [Link] = dtrAuthor
[Link]() [Link]()
[Link]() End Sub

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 [Link]
Partial Class _Default
Inherits [Link]
Dim constr As String =
[Link]("DatabaseConnectionString1").Connection String
Protected Sub Page_Load(ByVal sender As Object, ByVal e As [Link]) Handles
[Link]
Dim conpubs As SqlConnection Dim cmdselect As SqlCommand Dim dtrAuthor As
SqlDataReader
conpubs = New SqlConnection(constr)
cmdselect = New SqlCommand("Select * from Author", conpubs) [Link]()
dtrAuthor = [Link]() [Link] = dtrAuthor
[Link]() [Link]()
[Link]() End Sub
End Class
Sample
output

28
Experiment No:15
Title Write a Program to bind data using data grid.
Objective To bind data using data grid.
Algortihm Imports [Link]

Partial Class _Default


Inherits [Link]
Dim constr As String =
[Link]("RajeevConnectionString1").ConnectionSt ring
Protected Sub Page_Load(ByVal sender As Object, ByVal e As [Link]) Handles
[Link]
Dim conpubs As SqlConnection
Dim cmdselect As SqlCommand
conpubs = New SqlConnection(constr)
cmdselect = New SqlCommand("select * from Author", conpubs)
[Link]()
[Link] = [Link]()
[Link]()
[Link]()
End Sub
Protected Sub datagrd_SelectedIndexChanged(ByVal sender As Object, ByVal e As
[Link]) Handles [Link]
End Sub
End Class

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 [Link]
Partial Class _Default
Inherits [Link]
Dim constr As String =
[Link]("DAtabaseConnectionString1").Connection String
Protected Sub Page_Load(ByVal sender As Object, ByVal e As [Link]) Handles
[Link]
Dim conpubs As SqlConnection Dim cmdselect As SqlCommand
conpubs = New SqlConnection(constr)
cmdselect = New SqlCommand("select * from Author", conpubs) [Link]()
[Link] = [Link]() [Link]()

29
[Link]()
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 [Link]
Partial Class _Default
Inherits [Link]

Dim constr As String =


[Link]("DatabaseConnectionString1").Connection String
Protected Sub Page_Load(ByVal sender As Object, ByVal e As [Link]) Handles
[Link]

Dim conpubs As SqlConnection


Dim cmdselect As SqlCommand
conpubs = New SqlConnection(constr)
cmdselect = New SqlCommand("select * from Author", conpubs)

[Link]()
[Link] = [Link]()
[Link]()
[Link]()

End Sub
End Class

Sample
output

30
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 [Link]
Partial Class _Default
Inherits [Link]
Dim constr As String =
[Link]("DatabaseConnectionString1").Connection String
Protected Sub Page_Load(ByVal sender As Object, ByVal e As [Link]) Handles
[Link]
If Not IsPostBack Then
Dim conpubs As SqlConnection Dim cmdselect As SqlCommand
conpubs = New SqlConnection(constr)
cmdselect = New SqlCommand("select * from Author", conpubs) [Link]()
[Link] = [Link]() [Link]()
[Link]() End If
End Sub
Protected Sub GridView1_RowCommand(ByVal sender As Object, ByVal e As
[Link]) Handles
[Link]
If [Link] = "select" Then [Link] =
[Link]
Else
[Link] = [Link]
End If
End Sub
End Class

Sample When we click select When we click on unselect


output

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 [Link]
Partial Class _Default
Inherits [Link]
Dim constr As String =
[Link]("RajeevConnectionString1").ConnectionSt ring
Protected Sub Page_Load(ByVal sender As Object, ByVal e As [Link]) Handles
[Link]
If Not IsPostBack Then
Dim conpubs As SqlConnection
Dim cmdselect As SqlCommand

31
Dim dtrAuthor As SqlDataReader
conpubs = New SqlConnection(constr)
cmdselect = New SqlCommand("Select * from Author", conpubs)
[Link]()
dtrAuthor = [Link]()
[Link] = dtrAuthor
[Link]()
[Link]()
[Link]()
End If
End Sub
Protected Sub dtrlstAuthor_CancelCommand(ByVal source As Object, ByVal e As
[Link]) Handles
[Link]
[Link] = "<li> Cancel Item!"
End Sub
Protected Sub dtrlstAuthor_DeleteCommand(ByVal source As Object, ByVal e As
[Link]) Handles
[Link]
[Link] = "<li> Delete Item!"
End Sub
Protected Sub dtrlstAuthor_EditCommand(ByVal source As Object, ByVal e As
[Link]) Handles
[Link]
[Link] &= "<li> Edit item!"
End Sub
Protected Sub dtrlstAuthor_ItemCommand(ByVal source As Object, ByVal e As
[Link]) Handles
[Link]
[Link] = "<li> Item command!"
End Sub
Protected Sub dtrlstAuthor_UpdateCommand(ByVal source As Object, ByVal e As
[Link]) Handles
[Link]
[Link] = "<li> Update Item!"
End Sub
End Class

Sample
output

32
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 [Link]
Imports [Link]
Partial Class _Default
Inherits [Link]
Dim constr As String =
[Link]("DatabaseConnectionString1").Connection String
Protected Sub Page_Load(ByVal sender As Object, ByVal e As [Link]) Handles
[Link]
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
[Link](datset) [Link] = datset [Link]()
End Sub
Protected Sub GridView1_PageIndexChanged(ByVal sender As Object, ByVal e As
[Link]) Handles [Link]

End Sub
Protected Sub GridView1_PageIndexChanging(ByVal sender As Object, ByVal e As
[Link]) Handles
[Link]
[Link] = [Link]
Binddatagrid()
End Sub
Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As
[Link]) Handles [Link]

End Sub
End Class

Sample
output

33
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 [Link]
Partial Class _Default
Inherits [Link]
Function CreateDatasource() As ICollection
Dim dt As New DataTable()
Dim dr As DataRow
[Link](New DataColumn("integervalue", GetType(Int32))) [Link](New
DataColumn("stringvalue", GetType(String)))
[Link](New DataColumn("currencyvalue", GetType(Double)))
Dim i As Integer
For i = 0 To 8
dr = [Link]() dr(0) = i
dr(1) = "item" + [Link] dr(2) = 1.23 * (i + 1) [Link](dr)
Next i
Dim dv As New DataView(dt) Return dv
End Function
Protected Sub Page_Load(ByVal sender As Object, ByVal e As [Link]) Handles
[Link]
If Not IsPostBack Then
[Link] = CreateDatasource()
[Link]()
End If
End Sub
End Class
Sample
output

34
9
8
7
6
5
4
3
2
1

15
14
13
12
11
10
S No.
Name
Enroll No.
Date of Experiment ->

Exp. Exectution (5)

Viva/File(5)

Exp. Exectution (5)


GUIDELINES FOR CONTINUOUS ASSESSMENT

Viva/File(5)

Exp. Exectution (5)


Continuous Lab assessment sheet

Viva/File(5)

Exp. Exectution (5)

Viva/File(5)

Exp. Exectution (5)

Viva/File(5)

35
16

17

18

19

20

21

22

23

24

25

Internal Lab Assessment (End Semester)

S No. Enroll no. Name Lab file Attendance Quiz Viva Program with Total
(10) (10) (10) (10) execution(10) (50)

36

You might also like