0% found this document useful (0 votes)
11 views37 pages

707 ASP Assignment

The document outlines a practical assignment involving the creation of various web pages using ASP.NET. Tasks include demonstrating master pages, navigation controls, user input forms with validation, and CRUD operations on a news table and employee table. Additionally, it includes displaying data in different controls like GridView, DataList, Repeater, and FormView, along with a login page functionality.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views37 pages

707 ASP Assignment

The document outlines a practical assignment involving the creation of various web pages using ASP.NET. Tasks include demonstrating master pages, navigation controls, user input forms with validation, and CRUD operations on a news table and employee table. Additionally, it includes displaying data in different controls like GridView, DataList, Repeater, and FormView, along with a login page functionality.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

1 505 – Practical Assignment

[Link] a web page to demonstrate use of master page using themes, CSS.

Answer:

Design:

Output:

2. Create a web page to demonstrate the use of navigation controls.


Answer:
Design:

Output:

3. Create the application that accepts name, password, age, email id, and user id. All the information
entry is compulsory. Password should be reconfirmed. Age should be within 21 to 30. Email id should
be valid. User id should have at least a capital letter and digit as well as length should be between 7
and 20 characters.
Answer:

Design:

707-tybca 1
2 505 – Practical Assignment

Output:

4. Consider the following table:


tblnews (newsid, newsdtl, newsdate)

- Create a web page to insert data with proper validation in above table and display data in gridview
control using coding.
Answer:

Design:

Source:

Imports [Link]
Imports [Link]
Imports [Link]

Partial Class _Default


Inherits [Link]

Dim constring As String = [Link]("ConnectionString").ToString()


Dim con As New SqlConnection(constring)
Dim cmd As New SqlCommand
Dim da As SqlDataAdapter
Dim dt As DataTable

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


Try
[Link] = constring
[Link] = con
Catch ex As Exception
[Link] = [Link]
End Try
fillgrid()
End Sub

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

707-tybca 2
3 505 – Practical Assignment

Try
[Link] = "insert into tblnews values('" & [Link] & "','" & [Link] & "')"
[Link]()
[Link]()
Catch ex As Exception
[Link] = [Link]
End Try
fillgrid()
clearcontrols()
[Link]()
End Sub

Sub fillgrid()
Try
[Link] = "select * from tblnews"
da = New SqlDataAdapter(cmd)
dt = New DataTable
[Link](dt)
[Link] = dt
[Link]()
Catch ex As Exception
[Link] = [Link]
End Try
End Sub

Sub clearcontrols()
[Link] = ""
End Sub

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


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

Output:

- Create a web page to display data in gridview using wizard.


Answer:

Design:

Output:

- Create a Web page to display all the news details provide the update and delete facility on it.
Answer:

Design:

707-tybca 3
4 505 – Practical Assignment

Source:

Imports [Link]
Imports [Link]
Imports [Link]

Partial Class Default3


Inherits [Link]

Dim constring As String = [Link]("ConnectionString").ToString()


Dim con As New SqlConnection(constring)
Dim cmd As New SqlCommand
Dim da As SqlDataAdapter
Dim dt As DataTable

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


Try
[Link] = constring
[Link] = con
Catch ex As Exception
[Link] = [Link]
End Try
fillgrid()
End Sub

Sub fillgrid()
Try
[Link] = "select * from tblnews"
da = New SqlDataAdapter(cmd)
dt = New DataTable
[Link](dt)
[Link] = dt
[Link]()
Catch ex As Exception
[Link] = [Link]
End Try
End Sub

Sub clearcontrols()
[Link] = ""
End Sub

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


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

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


Try
[Link] = "update tblnews set newsdtl = '" & [Link] & "',newsdate = '" &
[Link] & "' where newsid = " & [Link] & ""
[Link]()
[Link]()
Catch ex As Exception
[Link] = [Link]
End Try
fillgrid()
clearcontrols()
[Link]()
[Link] = ""
End Sub

707-tybca 4
5 505 – Practical Assignment

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


[Link]) Handles [Link]
Try
Dim nid As Integer = [Link]([Link]).Item(0)
Try
[Link] = "delete from tblnews where newsid = " & nid & ""
[Link]()
[Link]()
Catch ex As Exception
[Link] = [Link]
End Try
fillgrid()
clearcontrols()
[Link]()
Catch ex As Exception

End Try
End Sub

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


Handles [Link]
Try
Dim nid, ndtl, ndate As Label

nid = CType([Link]("lblnewsid"), Label)


ndate = CType([Link]("lblnewsdate"), Label)
ndtl = CType([Link]("lblnewsdtl"), Label)

[Link] = [Link]
[Link] = [Link]
[Link] = [Link]
Catch ex As Exception
[Link] = [Link]
End Try
End Sub

End Class

Output:

- Create a web page that provide date wise searching.


Answer:

Design:

Source:

Imports [Link]
Imports [Link]
Imports [Link]

707-tybca 5
6 505 – Practical Assignment

Partial Class Default4


Inherits [Link]

Dim constring As String = [Link]("ConnectionString").ToString()


Dim con As New SqlConnection(constring)
Dim cmd As New SqlCommand
Dim da As SqlDataAdapter
Dim dt As DataTable

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


Try
[Link] = constring
[Link] = con
Catch ex As Exception
[Link] = [Link]
End Try
'fillgrid()
End Sub

Sub fillgrid()
Try
[Link] = "select * from tblnews1"
da = New SqlDataAdapter(cmd)
dt = New DataTable
[Link](dt)
[Link] = dt
[Link]()
Catch ex As Exception
[Link] = [Link]
End Try
End Sub
Protected Sub btnsearch_Click(ByVal sender As Object, ByVal e As [Link]) Handles [Link]
Dim sdate As String = [Link]
Try
[Link] = "select * from tblnews1 where newsdate = '" & sdate & "' "
[Link]()
[Link]()
Catch ex As Exception
[Link] = [Link]
End Try
searchfillgrid()
[Link] = sdate
[Link]()
End Sub
Sub searchfillgrid()
da = New SqlDataAdapter(cmd)
dt = New DataTable
[Link](dt)
[Link] = dt
[Link]()
End Sub
End Class

Output:

5. Consider the following table:


tblemp(DeptId, DeptName, EmpName, salary).

- Create a web page that provide insert, update and delete functionality with proper validation.
Answer:

Design:

707-tybca 6
7 505 – Practical Assignment

Source:
Imports [Link]
Imports [Link]
Imports [Link]

Partial Class _Default


Inherits [Link]

Dim constring As String = [Link]("cns").ToString


Dim con As New SqlConnection
Dim cmd As New SqlCommand
Dim da As SqlDataAdapter
Dim dt As DataTable
Dim did As Integer

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


Try
[Link] = constring
[Link] = con
Catch ex As Exception
[Link] = [Link]
End Try
fillgrid()
End Sub

Sub fillgrid()
Try
[Link] = "select * from tblemp order by deptid"
da = New SqlDataAdapter(cmd)
dt = New DataTable
[Link](dt)
[Link] = dt
[Link]()
Catch ex As Exception
[Link] = [Link]
End Try
End Sub

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


Try
If [Link] = "Insert" Then
getdeptid()
[Link] = "insert into tblemp values(" & did & ",'" & [Link] & "','" &
[Link] & "','" & [Link] & "')"
[Link]()
[Link]()
Else
[Link] = "update tblemp set empname='" & [Link] & "',salary='" & [Link]
& "' where deptid=" & [Link] & ""
[Link]()
[Link]()
[Link] = "Insert"
End If

Catch ex As Exception
[Link] = [Link]
End Try
fillgrid()
clearcontrols()
[Link]()
End Sub

707-tybca 7
8 505 – Practical Assignment

Sub clearcontrols()
[Link] = ""
[Link] = ""
End Sub

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


[Link]) Handles [Link]
Try
[Link] = [Link]
fillgrid()
Catch ex As Exception
[Link] = [Link]
End Try
End Sub

Sub getdeptid()
Try
did = [Link] + 101
Catch ex As Exception
[Link] = [Link]
End Try
End Sub

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


[Link]) Handles [Link]
Try
Dim d_did As Integer = [Link]([Link]).Item(0)
Dim d_empname As String = [Link]([Link]).Item(1)

[Link] = "delete from tblemp where deptid = " & d_did & " and empname = '" & d_empname
& "' "
[Link]()
[Link]()
Catch ex As Exception
[Link] = [Link]
End Try
fillgrid()
[Link]()
End Sub

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


[Link]
Try
Dim ldname, lename, lsalary As Label

ldname = CType([Link]("lbldeptname"), Label)


lename = CType([Link]("lblempname"), Label)
lsalary = CType([Link]("lblsalary"), Label)

[Link] = [Link]
[Link] = [Link]
[Link] = [Link]
[Link] = [Link] + 101

[Link] = "Update"

Catch ex As Exception
[Link] = [Link]
End Try
End Sub
End Class

Output:

- Create a web page to display all records in Data list controls.

707-tybca 8
9 505 – Practical Assignment

Answer:

Design:

Source:
Imports [Link]
Imports [Link]
Imports [Link]

Partial Class Default2


Inherits [Link]

Dim constring As String = [Link]("cns").ToString


Dim con As New SqlConnection
Dim cmd As New SqlCommand
Dim da As SqlDataAdapter
Dim dt As DataTable

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


Try
[Link] = constring
[Link] = con
Catch ex As Exception
End Try
fillgrid()
End Sub

Sub fillgrid()
Try
[Link] = "select * from tblemp order by deptid"
da = New SqlDataAdapter(cmd)
dt = New DataTable
[Link](dt)
[Link] = dt
[Link]()
Catch ex As Exception
End Try
End Sub
End Class

Output:

- Create a web page to display all records in Repeater controls.


Answer:

Design:

Source:
Imports [Link]
Imports [Link]
Imports [Link]

Partial Class Default3


Inherits [Link]

Dim constring As String = [Link]("cns").ToString

707-tybca 9
10 505 – Practical Assignment

Dim con As New SqlConnection


Dim cmd As New SqlCommand
Dim da As SqlDataAdapter
Dim dt As DataTable

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


Try
[Link] = constring
[Link] = con
Catch ex As Exception
End Try
fillgrid()
End Sub

Sub fillgrid()

Try
[Link] = "select * from tblemp order by deptid"
da = New SqlDataAdapter(cmd)
dt = New DataTable
[Link](dt)
[Link] = dt
[Link]()
Catch ex As Exception
End Try
End Sub
End Class

Output:

- Create a web page to display all records in form view controls.


Answer:

Design:

Source:
Imports [Link]
Imports [Link]
Imports [Link]

Partial Class Default4


Inherits [Link]

Dim constring As String = [Link]("cns").ToString


Dim con As New SqlConnection
Dim cmd As New SqlCommand
Dim da As SqlDataAdapter
Dim dt As DataTable

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


Try
[Link] = constring
[Link] = con
Catch ex As Exception
End Try
fillgrid()
End Sub
Sub fillgrid()
Try
[Link] = "select * from tblemp order by deptid"
da = New SqlDataAdapter(cmd)
dt = New DataTable

707-tybca 10
11 505 – Practical Assignment

[Link](dt)
[Link] = dt
[Link]()
Catch ex As Exception
End Try
End Sub
End Class

Output:

6. Create a Login page. After successfully login, page is redirect to home page, which displays
Username and logout option.
Answer:

Design of Login Page:

Source of Login Page:


Imports [Link]
Imports [Link]
Imports [Link]
Partial Class _Default
Inherits [Link]

Dim constring As String = [Link]("cns").ToString


Dim con As New SqlConnection(constring)
Dim cmd As New SqlCommand
Dim dr As SqlDataReader

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


Try
[Link] = "select * from tbllogin where username='" & [Link] & "' and password='" &
[Link] & "' "
[Link]()
dr = [Link]()

If [Link] = True Then


Session("username") = [Link]
[Link]("~/[Link]")
Else
[Link] = "UserName and Password does not match"
End If
Catch ex As Exception
[Link] = [Link]
End Try
[Link]()
End Sub

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


Try
[Link] = constring
[Link] = con
Catch ex As Exception
[Link] = [Link]
End Try
End Sub
End Class

Output of Login Page:

707-tybca 11
12 505 – Practical Assignment

Design of Home Page:

Source of Home Page:


Partial Class Home
Inherits [Link]

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


[Link] = Session("username")
End Sub

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


[Link]("~/[Link]")
End Sub
End Class
Output of Home Page:

7. Create website using .net technology for online shopping of gifts. Give facility to register as admin
who can add various categories of gifts. The admin can also add, update or delete any gift articles on
the site. Users can register and view various gift articles and place orders using COD mode only.

Answer:

Design For Admin:

Source:

Imports [Link]

Imports [Link]

Imports [Link]

Partial Class adminpanel

Inherits [Link]

Dim constring As String = [Link]("cns").ToString()

Dim con As New SqlConnection(constring)

Dim cmd As New SqlCommand

Dim da As SqlDataAdapter

Dim dt As DataTable

Dim filepath, filepath1 As String

Dim flag As Boolean = False

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

[Link] = Session("admin")

707-tybca 12
13 505 – Practical Assignment

Try

[Link] = constring

[Link] = con

Catch ex As Exception

[Link] = [Link]

End Try

fillgrid()

img_main.Visible = False

End Sub

Sub fillgrid()

Try

[Link] = "select * from tblgiftmaster where admin='" & [Link] & "'"

da = New SqlDataAdapter(cmd)

dt = New DataTable

[Link](dt)

[Link] = dt

[Link]()

Catch ex As Exception

[Link] = [Link]

End Try

End Sub

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


Button_Main.Click

Try

If Button_Main.Text = "Insert" Then

If [Link] = True Then

filepath = "~/images/" + [Link]

[Link]([Link]("~/images/") + [Link])

End If

[Link] = "insert into tblgiftmaster values('" & [Link] & "','" & [Link] & "','" &
[Link] & "','" & filepath & "')"

Else

If [Link] = True Then

filepath1 = "~/images/" + [Link]

[Link]([Link]("~/images/”) +[Link])

flag = True

Dim dimg As String = [Link](img_main.ImageUrl)

If [Link](dimg) Then

[Link](dimg)

End If

img_main.Visible = False

End If

707-tybca 13
14 505 – Practical Assignment

If flag Then

[Link] = "update tblgiftmaster set gname='" & [Link] & "',gprice='" &
[Link] & "',filepath='" & filepath1 & "' where gid = " & [Link] & ""

Else

[Link] = "update tblgiftmaster set gname='" & [Link] & "',gprice='" &
[Link] & "' where gid = " & [Link] & ""

End If

End If

[Link]()

[Link]()

Catch ex As Exception

[Link] = [Link]

End Try

fillgrid()

[Link]()

[Link] = ""

[Link] = ""

End Sub

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


[Link]) Handles [Link]

Try

[Link] = [Link]

fillgrid()

Catch ex As Exception

[Link] = [Link]

End Try

End Sub

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


[Link]) Handles [Link]

Try

Dim gid As Integer = [Link]([Link]).Item(0)

Dim vimage As String = [Link]([Link]).Item(1)

[Link] = "delete from tblgiftmaster where gid =" & gid & " "

[Link]()

[Link]()

Dim fileexists As String = [Link](vimage)

If [Link](fileexists) Then

[Link](fileexists)

End If

Catch ex As Exception

[Link] = [Link]

End Try

707-tybca 14
15 505 – Practical Assignment

fillgrid()

[Link]()

End Sub

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


[Link]

Try

img_main.Visible = True

Dim g_id, g_name, g_price, g_admin As Label

Dim gimage As Image

g_id = CType([Link]("lblid"), Label)

g_name = CType([Link]("lblname"), Label)

g_price= CType([Link]("lblprice"), Label)

g_admin=CType([Link]("lbl_admin"), Label)

gimage = CType([Link]("Image1"), Image)

[Link] = g_id.Text

[Link] = g_name.Text

[Link] = g_price.Text

img_main.ImageUrl = [Link]

Button_Main.Text = "Update"

Catch ex As Exception

[Link] = [Link]

End Try

End Sub

End Class

OutPut:

Design For User:

Source of User:

Imports [Link]

Imports [Link]

Imports [Link]

Partial Class Userhome

Inherits [Link]

707-tybca 15
16 505 – Practical Assignment

Dim constring As String = [Link]("cns").ToString()

Dim con As New SqlConnection(constring)

Dim cmd As New SqlCommand

Dim da As SqlDataAdapter

Dim dt As DataTable

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

[Link] = Session("User")

Try

[Link] = constring

[Link] = con

Catch ex As Exception

End Try

filldatalist()

End Sub

Sub filldatalist()

Try

[Link] = "select * from tblgiftmaster"

da = New SqlDataAdapter(cmd)

dt = New DataTable

[Link](dt)

[Link] = dt

[Link]()

Catch ex As Exception

End Try

End Sub

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


[Link]

Try

Dim g_id, g_name, g_admin, g_price As Label

Dim image As Image

g_id = CType([Link]("lblid"), Label)

g_name = CType([Link]("lblname"), Label)

g_admin=CType([Link]("lbl_admin"), Label)

g_price =CType([Link]("lblprice"), Label)

image = CType([Link]("Image1"), Image)

[Link] = g_id.Text

[Link]("~/[Link]?gid=" & g_id.Text & "&gname=" & g_name.Text & "&gprice=" &
g_price.Text & "&admin=" & g_admin.Text & "&image=" & [Link])

Catch ex As Exception

End Try

End Sub

707-tybca 16
17 505 – Practical Assignment

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


[Link]) Handles [Link]

Try

[Link] = [Link]

filldatalist()

Catch ex As Exception

[Link] = [Link]

End Try

End Sub

End Class

Output of User penal:

Product Design:

Source of Product:

Partial Class Product

Inherits [Link]

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

[Link] = [Link]("gid")

[Link] = [Link]("gname")

[Link] = [Link]("gprice")

[Link] = [Link]("admin")

[Link] = [Link]("image")

End Sub

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


[Link]

[Link] = 0

[Link] = [Link]

End Sub

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

[Link] = -1

End Sub

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

707-tybca 17
18 505 – Practical Assignment

If [Link] Then

[Link] = ""

[Link]("~/[Link]")

Else

[Link] = "Please checked radio button"

End If

End Sub

End Class

Output of Product Design:

8. Create .NET based module that can be used for online missing person registration and processing
site where user can register and enter information about missing person. Create appropriate tables
and provide appropriate validations.

Answer:

Design:

Source:

Imports [Link]

Imports [Link]

Partial Class _Default

Inherits [Link]

Dim constring As String = [Link]("cns").ToString

Dim con As New SqlConnection(constring)

Dim cmd As New SqlCommand

Dim gender, filepath As String

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

Try

[Link] = constring

[Link] = con

Catch ex As Exception

End Try

End Sub

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

707-tybca 18
19 505 – Practical Assignment

If [Link] = True Then

filepath = "~/images/" + [Link]

[Link]([Link]("~/images/") + [Link])

End If

If [Link] Then

gender = "Male"

End If

If [Link] Then

gender = "Female"

End If

Try

[Link] = "insert into tblmissingperson values('" & [Link] & "','" & [Link] & "'," &
[Link] & ",'" & gender & "','" & [Link] & "','" & [Link] & "','" &
[Link] & "','" & [Link] & "','" & filepath & "')"

[Link]()

[Link]()

Catch ex As Exception

End Try

[Link]()

[Link] = ""

[Link] = ""

[Link] = ""

[Link] = ""

[Link] = ""

[Link] = False

[Link] = False

End Sub

End Class

9. Design module using [Link] "shoponline" for online shopping which provide online

shopping items like jeans shirts, shirt etc. It includes view of items along with their price.

Add selected items into cart and display shipping details. Provide proper validation.

Answer:

Design of Home Page:

Source:

Imports [Link]

707-tybca 19
20 505 – Practical Assignment

Partial Class home

Inherits [Link]

Dim db As New dbhelper()

Protected Sub AddToCart_Click(ByVal sender As Object, ByVal e As EventArgs)

Dim button As [Link] = CType(sender, [Link])

Dim productId As Integer = Convert.ToInt32([Link])

Dim data As DataTable = [Link]("select * from tblcart where uid = 1 and pid = " & productId & "")

If [Link] > 0 Then

[Link](Me, "product already exist in the cart")

Return

End If

[Link]("insert into tblcart(uid,pid) values(1," & productId & ")")

[Link](Me, "product added to cart")

End Sub

End Class

Dbhelper class:

Imports [Link]

Imports [Link]

Imports [Link]

Public Class dbhelper

Dim constr As String = [Link]("cns").ToString()

Dim con As New SqlConnection(constr)

Dim cmd As New SqlCommand

Sub New()

[Link] = con

End Sub

Sub exeQuery(ByVal query As String)

[Link] = query

[Link]()

[Link]()

[Link]()

End Sub

Function getData(ByVal query As String) As DataTable

[Link] = query

Dim dt As New DataTable

Dim da As New SqlDataAdapter(cmd)

[Link]()

[Link](dt)

[Link]()

Return dt

End Function

707-tybca 20
21 505 – Practical Assignment

End Class

Design for Cart:

Source:

Imports [Link]

Partial Class show_cart

Inherits [Link]

Dim db As New dbhelper()

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

Dim data As DataTable = [Link]("select * from tbluser where uid = 1")

[Link] = [Link](0).Item(1)

[Link] = [Link](0).Item(2)

[Link] = [Link](0).Item(4)

[Link] = [Link](0).Item(3)

[Link] = "select c.cart_id as cart_id,p.* from tblproducts p ,tblcart c where [Link] =


[Link] and [Link] = 1"

End Sub

End Class

10. Design module using [Link] "online book shop" for online book shopping. User can view the
different category of books and place an order for book. Admin can manage the book stock. Provide
proper validation.

Answer:

Design for User:

Source for User:

Imports [Link]

Imports [Link]

Imports [Link]

Partial Class user

Inherits [Link]

Dim constring As String = [Link]("cns").ToString

Dim con As New SqlConnection(constring)

707-tybca 21
22 505 – Practical Assignment

Dim cmd As New SqlCommand

Dim da As SqlDataAdapter

Dim dt As DataTable

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

Try

[Link] = constring

[Link] = con

Catch ex As Exception

End Try

fillgrid()

End Sub

Sub fillgrid()

[Link] = "select * from tblbook"

da = New SqlDataAdapter(cmd)

dt = New DataTable

[Link](dt)

[Link] = dt

[Link]()

End Sub

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


[Link]

Dim bid, bname, bprice, stock As Label

bid = CType([Link]("lblid"), Label)

bname = CType([Link]("lblname"), Label)

bprice = CType([Link]("lblprice"), Label)

stock = CType([Link]("lblstock"), Label)

[Link]("~/[Link]?bid=" & [Link] & "&bname=" & [Link] & "&bprice=" & [Link]
& "&stock=" & [Link])

End Sub

End Class

Design for Product:

Source for Product:

Partial Class Product

Inherits [Link]

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

[Link] = [Link]("bid")

[Link] = [Link]("bname")

707-tybca 22
23 505 – Practical Assignment

[Link] = [Link]("bprice")

End Sub

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

[Link]("~/[Link]")

End Sub

End Class

Design for Admin:

Source for Admin:

Imports [Link]

Imports [Link]

Imports [Link]

Partial Class Admin_Panel

Inherits [Link]

Dim constring As String = [Link]("cns").ToString

Dim con As New SqlConnection(constring)

Dim cmd As New SqlCommand

Dim da As SqlDataAdapter

Dim dt As DataTable

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

Try

[Link] = constring

[Link] = con

Catch ex As Exception

[Link] = [Link]

End Try

fillgrid()

End Sub

Sub fillgrid()

[Link] = "select * from tblbook"

da = New SqlDataAdapter(cmd)

dt = New DataTable

[Link](dt)

[Link] = dt

[Link]()

End Sub

707-tybca 23
24 505 – Practical Assignment

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


Button_main.Click

Try

If Button_main.Text = "Insert" Then

[Link] = "insert into tblbook values('" & [Link] & "','" & [Link] & "','" &
[Link] & "')"

Else

[Link] = "update tblbook set bname='" & [Link] & "',stock='" & [Link] &
"',bprice='" & [Link] & "' where bid = " & [Link] & ""

Button_main.Text = "Insert"

[Link] = ""

End If

[Link]()

[Link]()

Catch ex As Exception

[Link] = [Link]

End Try

fillgrid()

[Link]()

clear()

End Sub

Sub clear()

[Link] = ""

[Link] = ""

[Link] = ""

End Sub

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


[Link]) Handles [Link]

Try

Dim id As Integer = [Link]([Link]).Item(0)

[Link] = "delete from tblbook where bid=" & id & ""

[Link]()

[Link]()

Catch ex As Exception

[Link] = [Link]

End Try

fillgrid()

[Link]()

End Sub

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


[Link]

Try

Dim bid, bname, bprice, stock As Label

707-tybca 24
25 505 – Practical Assignment

bid = CType([Link]("lblid"), Label)

bname = CType([Link]("lblname"), Label) bprice =


CType([Link]("lblprice"), Label) stock =
CType([Link]("lblstock"), Label)

[Link] = [Link]

[Link] = [Link]

[Link] = [Link]

[Link] = [Link]

Button_main.Text = "Update"

Catch ex As Exception

[Link] = [Link]

End Try

End Sub

End Class

11. Create interactive pages using .NET which accept Information pertaining to Airline booking. It
store information in the database using entry form and display information for given Booking-id. Use
following table for this purpose: Bookig master (booking_id, booking date, Name, address, contact_no,
Source_Place, Destination_Place). Provide appropriate validations.

Answer:

Design:

Source:

Imports [Link]

Imports [Link]

Imports [Link]

Partial Class _Default

Inherits [Link]

Dim constring As String = [Link]("cns").ToString

Dim con As New SqlConnection(constring)

Dim cmd As New SqlCommand

Dim da As SqlDataAdapter

Dim dt As DataTable

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

Try

[Link] = constring

[Link] = con

Catch ex As Exception

[Link] = [Link]

707-tybca 25
26 505 – Practical Assignment

End Try

End Sub

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

Try

[Link] = "insert into tblbooking values('" & [Link] & "','" & [Link] &
"','" & [Link] & "','" & [Link] & "','" & [Link] & "')"

[Link]()

[Link]()

Catch ex As Exception

[Link] = [Link]

End Try

[Link]()

[Link] = ""

[Link] = ""

[Link] = ""

[Link] = ""

End Sub

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

Try

[Link] = "select * from tblbooking where bid=" & [Link] & ""

da = New SqlDataAdapter(cmd)

dt = New DataTable

[Link](dt)

[Link] = dt

[Link]()

Catch ex As Exception

End Try

End Sub

End Class

12. Create a website for Domino’s Pizza and give facility for ordering items. Maintain session for
logged in users.

Answer:

Design:

Source:

Imports [Link]

Imports [Link]

707-tybca 26
27 505 – Practical Assignment

Imports [Link]

Partial Class Default2

Inherits [Link]

Dim constring As String = [Link]("cns").ToString

Dim con As New SqlConnection(constring)

Dim cmd As New SqlCommand

Dim da As SqlDataAdapter

Dim dt As DataTable

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

Try

[Link] = constring

[Link] = con

Catch ex As Exception

End Try

fillgrid()

End Sub

Sub fillgrid()

[Link] = "select * from tblpizza"

da = New SqlDataAdapter(cmd)

dt = New DataTable

[Link](dt)

[Link] = dt

[Link]()

End Sub

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


[Link]

Try

Dim price As Label

Dim photo As Image

photo = CType([Link]("Image1"), Image)

price = CType([Link]("Label1"), Label)

[Link]("~/[Link]?photo=" & [Link] & "&price=" & [Link])

Catch ex As Exception

End Try

End Sub

End Class

Design for Order:

707-tybca 27
28 505 – Practical Assignment

Source for Design:

Partial Class _Default

Inherits [Link]

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

[Link] = [Link]("photo")

[Link] = [Link]("price")

End Sub

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

[Link]("~/[Link]")

End Sub

End Class

13. Develop a .NET application for "E-Shopping system" will provide features like:

- Admin/user login page

- Admin can insert, update, and delete products information in database.

- Create appropriate database tables for this and provide appropriate validations.

Answer:

Design For Admin:

Source:

Imports [Link]

Imports [Link]

Imports [Link]

Partial Class adminpanel

Inherits [Link]

Dim constring As String = [Link]("cns").ToString()

Dim con As New SqlConnection(constring)

Dim cmd As New SqlCommand

Dim da As SqlDataAdapter

Dim dt As DataTable

Dim filepath, filepath1 As String

707-tybca 28
29 505 – Practical Assignment

Dim flag As Boolean = False

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

[Link] = Session("admin")

Try

[Link] = constring

[Link] = con

Catch ex As Exception

[Link] = [Link]

End Try

fillgrid()

img_main.Visible = False

End Sub

Sub fillgrid()

Try

[Link] = "select * from tblgiftmaster where admin='" & [Link] & "'"

da = New SqlDataAdapter(cmd)

dt = New DataTable

[Link](dt)

[Link] = dt

[Link]()

Catch ex As Exception

[Link] = [Link]

End Try

End Sub

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


Button_Main.Click

Try

If Button_Main.Text = "Insert" Then

If [Link] = True Then

filepath = "~/images/" + [Link]

[Link]([Link]("~/images/") + [Link])

End If

[Link] = "insert into tblgiftmaster values('" & [Link] & "','" & [Link] & "','" &
[Link] & "','" & filepath & "')"

Else

If [Link] = True Then

filepath1 = "~/images/" + [Link]

[Link]([Link]("~/images/")+[Link])

flag = True

Dim dimg As String = [Link](img_main.ImageUrl)

If [Link](dimg) Then

[Link](dimg)

707-tybca 29
30 505 – Practical Assignment

End If

img_main.Visible = False

End If

If flag Then

[Link] = "update tblgiftmaster set gname='" & [Link] & "',gprice='" &
[Link] & "',filepath='" & filepath1 & "' where gid = " & [Link] & ""

Else

[Link] = "update tblgiftmaster set gname='" & [Link] & "',gprice='" &
[Link] & "' where gid = " & [Link] & ""

End If

End If

[Link]()

[Link]()

Catch ex As Exception

[Link] = [Link]

End Try

fillgrid()

[Link]()

[Link] = ""

[Link] = ""

End Sub

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


[Link]) Handles [Link]

Try

[Link] = [Link]

fillgrid()

Catch ex As Exception

[Link] = [Link]

End Try

End Sub

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


[Link]) Handles [Link]

Try

Dim gid As Integer = [Link]([Link]).Item(0)

Dim vimage As String = [Link]([Link]).Item(1)

[Link] = "delete from tblgiftmaster where gid=" & gid & " "

[Link]()

[Link]()

Dim fileexists As String = [Link](vimage)

If [Link](fileexists) Then

[Link](fileexists)

End If

707-tybca 30
31 505 – Practical Assignment

Catch ex As Exception

[Link] = [Link]

End Try

fillgrid()

[Link]()

End Sub

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


[Link]

Try

img_main.Visible = True

Dim g_id, g_name, g_price, g_admin As Label

Dim gimage As Image

g_id = CType([Link]("lblid"), Label)

g_name = CType([Link]("lblname"), Label)

g_price = CType([Link]("lblprice"), Label)

g_admin = CType([Link]("lbl_admin"), Label)

gimage = CType([Link]("Image1"), Image)

[Link] = g_id.Text

[Link] = g_name.Text

[Link] = g_price.Text

img_main.ImageUrl = [Link]

Button_Main.Text = "Update"

Catch ex As Exception

[Link] = [Link]

End Try

End Sub

End Class

14. Develop "Online Complaint System" by providing following functionality.

Technician:

- Login

- View and Update status (Pending solved) of the complaint

Registered user:

- Give complaints according to services (Hardware / Software/ Internet)

Answer:

Design of Technician Panel:

Source of Technician Panel:

707-tybca 31
32 505 – Practical Assignment

Imports [Link]

Imports [Link]

Partial Class technician

Inherits [Link]

Dim constring As String = [Link]("cns").ToString

Dim con As New SqlConnection(constring)

Dim cmd As New SqlCommand

Dim da As SqlDataAdapter

Dim dt As DataTable

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

Try

[Link] = constring

[Link] = con

Catch ex As Exception

End Try

fillgrid()

End Sub

Sub fillgrid()

[Link] = "select * from tblcomplaint"

da = New SqlDataAdapter(cmd)

dt = New DataTable

[Link](dt)

[Link] = dt

[Link]()

End Sub

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


[Link]

Try

Dim cid, com, complaint, state As Label

cid = CType([Link]("lblid"), Label)

com = CType([Link]("lblcom"), Label)

complaint = CType([Link]("lblcomplaint"), Label)

state = CType([Link]("lblstate"), Label)

[Link] = [Link]

If [Link] = [Link] Then

[Link] = True

End If

If [Link] = [Link] Then

[Link] = True

End If

If [Link] = [Link] Then

707-tybca 32
33 505 – Practical Assignment

[Link] = True

End If

[Link] = [Link]

If [Link] = "Pending" Then

[Link] = 0

End If

If [Link] = "Solve" Then

[Link] = 1

End If

Catch ex As Exception

End Try

End Sub

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

Try

[Link] = "update tblcomplaint set state='" & [Link] & "' where cid=" &
[Link] & ""

[Link]()

[Link]()

Catch ex As Exception

End Try

fillgrid()

[Link]()

[Link] = 0

[Link] = ""

[Link] = False

[Link] = False

[Link] = False

End Sub

End Class

User Panel for Complaint:

Source:

Imports [Link]

Imports [Link]

Partial Class complaint

Inherits [Link]

Dim constring As String = [Link]("cns").ToString

Dim con As New SqlConnection(constring)

Dim cmd As New SqlCommand

707-tybca 33
34 505 – Practical Assignment

Dim com As String

Dim s As String = "Pending"

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

If [Link] Then

com = [Link]

End If

If [Link] Then

com = [Link]

End If

If [Link] Then

com = [Link]

End If

Try

[Link] = "insert into tblcomplaint values('" & com & "','" & [Link] & "','" & s & "')"

[Link]()

[Link]()

Catch ex As Exception

End Try

[Link]()

[Link] = ""

[Link] = False

[Link] = False

[Link] = False

End Sub

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

Try

[Link] = constring

[Link] = con

Catch ex As Exception

End Try

End Sub

End Class

15. Develop the "Missing Person Information Management System" for police department by

providing following functionality.

Police: - View information of missing person - Login

Relative: - Register and provide missing person information

Guest User: - If any, provide additional information

Answer:

Design:

707-tybca 34
35 505 – Practical Assignment

Source:

Imports [Link]

Imports [Link]

Partial Class _Default

Inherits [Link]

Dim constring As String = [Link]("cns").ToString

Dim con As New SqlConnection(constring)

Dim cmd As New SqlCommand

Dim gender, filepath As String

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

Try

[Link] = constring

[Link] = con

Catch ex As Exception

End Try

End Sub

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

If [Link] = True Then

filepath = "~/images/" + [Link]

[Link]([Link]("~/images/") + [Link])

End If

If [Link]

gender = "Male"

End If

If [Link] Then

gender = "Female"

End If

Try

[Link] = "insert into tblmissingperson values('" & [Link] & "','" & [Link] & "'," &
[Link] & ",'" & gender & "','" & [Link] & "','" & [Link] & "','" &
[Link] & "','" & [Link] & "','" & filepath & "')"

[Link]()

[Link]()

Catch ex As Exception

End Try

[Link]()

[Link] = ""

707-tybca 35
36 505 – Practical Assignment

[Link] = ""

[Link] = ""

[Link] = ""

[Link] = ""

[Link] = False

[Link] = False

End Sub

End Class

16. Develop module using .NET to keep track of visitors in museum which stores visitor’s details like
name, time of visit, date of visit, contact no, etc. Also give facility to search and display visitor’s data
based on the date visited.

Answer:

Design:

Source:

Dbhelper class:

Imports [Link]

Imports [Link]

Imports [Link]

Public Class dbhelper

Dim constr As String = [Link]("cns").ToString()

Dim con As New SqlConnection(constr)

Dim cmd As New SqlCommand

Sub New()

[Link] = con

End Sub

Sub exeQuery(ByVal query As String)

[Link] = query

[Link]()

[Link]()

[Link]()

End Sub

Function getData(ByVal query As String) As DataTable

[Link] = query

Dim dt As New DataTable

Dim da As New SqlDataAdapter(cmd)

[Link]()

707-tybca 36
37 505 – Practical Assignment

[Link](dt)

[Link]()

Return dt

End Function

End Class

Partial Class addVisitor

Inherits [Link]

Dim db As New dbhelper()

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

Dim insertQuery As String = "INSERT INTO VisitorRecords (Name, DateOfVisit, ContactNo, Email) " & _

"VALUES ('" & [Link] & "', '" & [Link]("yyyy-MM-dd") & "', '" & [Link] & "', '" &
[Link] & "')"

[Link](insertQuery)

[Link] = "Record inserted"

End Sub

End Class

Design for Search:

Source:

Partial Class showData

Inherits [Link]

Dim db As New dbhelper()

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

[Link] = [Link]("select * from VisitorRecords")

[Link]()

End Sub

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

[Link] = [Link]("select * from VisitorRecords WHERE DateOfVisit = '" +


[Link]("yyyy-MM-dd") + "'")

[Link]()

End Sub

End Class

707-tybca 37

You might also like