Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.Data.SqlClient
- Public Class _Default
- Inherits System.Web.UI.Page
- 'Create Connection'
- Dim conn As SqlConnection
- Protected Sub DefaultPage_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
- Dim connStr As String = "(INSERT CONNECTION STRING)"
- conn = New SqlConnection(connStr)
- 'open the connection to the database'
- conn.Open()
- End Sub
- Private Sub DefaultPage_Unload(ByVal sender As Object) Handles Me.Unload
- conn.Close()
- End Sub
- Protected Sub ProgrammesGridView_CellClick(sender As Object, e As GridViewEditEventArgs) Handles DataGridView1.CellClick
- Dim indexNumber As Integer
- indexNumber = e.RowIndex 'Index number of the row that is selected'
- Session("programmeId") = ProgrammesGridView.Rows(indexNumber).Cells(0).Text
- End Sub
- Protected Sub CoursesGridView_CellClick(sender As Object, e As GridViewEditEventArgs) Handles DataGridView1.CellClick
- Dim indexNumber As Integer
- indexNumber = e.RowIndex 'Index number of the row that is selected'
- Session("courseId") = CoursesGridView.Rows(indexNumber).Cells(0).Text
- End Sub
- Protected Sub ProgrammesCreateButton_Click(sender As Object, e As EventArgs) Handles ProgrammeCreateButton.Click
- If ProgrammesGridView.SelectedValue != null Then
- Session("table") = "Programme"
- Session("mode") = "Create"
- Response.Redirect("Update.aspx")
- Else
- Msgbox("There are no rows currently selected.",,"ERROR!")
- End If
- End Sub
- Protected Sub ProgrammesEditButton_Click(sender As Object, e As EventArgs) Handles ProgrammeEditButton.Click
- If ProgrammesGridView.SelectedValue != null Then
- Session("table") = "Programme"
- Session("mode") = "Edit"
- Response.Redirect("Update.aspx")
- Else
- Msgbox("There are no rows currently selected.",,"ERROR!")
- End If
- End Sub
- Protected Sub ProgrammesDeleteButton_Click(sender As Object, e As EventArgs) Handles ProgrammeDeleteButton.Click
- If ProgrammesGridView.SelectedValue != null Then
- Session("table") = "Programme"
- Session("mode") = "Delete"
- Response.Redirect("Update.aspx")
- Else
- Msgbox("There are no rows currently selected.",,"ERROR!")
- End If
- End Sub
- Protected Sub CoursesCreateButton_Click(sender As Object, e As EventArgs) Handles CoursesCreateButton.Click
- If ProgrammesGridView.SelectedValue != null Then
- Session("table") = "Course"
- Session("mode") = "Create"
- Response.Redirect("Update.aspx")
- Else
- Msgbox("There are no rows currently selected.",,"ERROR!")
- End If
- End Sub
- Protected Sub CoursesEditButton_Click(sender As Object, e As EventArgs) Handles CoursesEditButton.Click
- If ProgrammesGridView.SelectedValue != null Then
- Session("table") = "Course"
- Session("mode") = "Edit"
- Response.Redirect("Update.aspx")
- Else
- Msgbox("There are no rows currently selected.",,"ERROR!")
- End If
- End Sub
- Protected Sub CoursesDeleteButton_Click(sender As Object, e As EventArgs) Handles CoursesDeleteButton.Click
- If ProgrammesGridView.SelectedValue != null Then
- Session("table") = "Course"
- Session("mode") = "Delete"
- Response.Redirect("Update.aspx")
- Else
- Msgbox("There are no rows currently selected.",,"ERROR!")
- End If
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement