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
- Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
- 'Dim objConn As New SqlConnection("Server=gebruiker-pc;Database=dbCarRental;Uid=sa; Pwd=empty;")
- 'Dim objCmd As New SqlCommand("getAllCars", objConn)
- 'objCmd.Parameters.Add("@car_id", SqlDbType.Int).Value = 3
- 'objCmd.CommandType = CommandType.StoredProcedure
- 'objConn.Open()
- 'Dim DR As SqlDataReader = objCmd.ExecuteReader()
- 'DetailsView1.DataSource = DR
- 'DetailsView1.DataBind()
- 'DR.Close()
- 'DR = Nothing
- 'objCmd.Dispose()
- 'objCmd = Nothing
- 'objConn.Close()
- 'objConn = Nothing
- filldatagrid(Convert.ToInt32(CarGrid.Rows(0).Cells(1).Text))
- CarGrid.SelectedIndex = 0
- End Sub
- Protected Sub CarGrid_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles CarGrid.SelectedIndexChanged
- 'MsgBox(CarGrid.SelectedRow.Cells(1).Text)
- filldatagrid(Convert.ToInt32(CarGrid.SelectedRow.Cells(1).Text))
- End Sub
- Public Sub filldatagrid(ByVal id As Integer)
- Dim objConn As New SqlConnection("Server=gebruiker-pc;Database=dbCarRental;Uid=sa; Pwd=empty;")
- Dim objCmd As New SqlCommand("getAllCars", objConn)
- objCmd.Parameters.Add("@car_id", SqlDbType.Int).Value = id
- objCmd.CommandType = CommandType.StoredProcedure
- objConn.Open()
- Dim DR As SqlDataReader = objCmd.ExecuteReader()
- DetailsView1.DataSource = DR
- DetailsView1.DataBind()
- DR.Close()
- DR = Nothing
- objCmd.Dispose()
- objCmd = Nothing
- objConn.Close()
- objConn = Nothing
- End Sub
- Private Sub DetailsView1_ItemInserting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DetailsViewInsertEventArgs) Handles DetailsView1.ItemInserting
- ' // Get Value from DropDown
- 'int TopicID = 0;
- 'foreach (DetailsViewRow row in ItemsDetailsView.Rows)
- '{
- ' if (row.Cells[0].Text == "Topic")
- ' {
- ' DropDownList TopicDropDown = (DropDownList)row.Cells[1].FindControl("Topic_TopicIDList");
- ' TopicID = int.Parse(TopicDropDown.SelectedValue.ToString());
- ' }
- '}
- ' MsgBox(CType(DetailsView1.Rows(1).Cells(0).Controls(0), Label))
- ' For Each row As DetailsViewRow In DetailsView1.Rows
- ' Dim cell1 As TableCell = row.Cells(1)
- ' Dim value1 As String
- ' value1 = cell1.Text
- ' MsgBox(value1)
- ' Next
- ' Dim item As New DetailsViewItem(col.ColumnName, row(index).ToString(), col.DataType.ToString(), col.DefaultValue)
- ' MsgBox(DetailsView1.Rows(1).Controls(0).)
- ' MsgBox([Enum].GetValues)
- ' tb = DetailsView1.FindControl("Categorie")
- ' s = tb.Text
- ' MsgBox(s.ToString)
- ' For Each dvr As DetailsViewRow In DetailsView1.Rows
- ' If dvr.Cells.Count = 2 Then
- ' If dvr.Cells(1).Controls.Count > 0 Then
- ' Dim txt As TextBox
- ' txt = dvr.Cells(1).Controls(0)
- ' MsgBox("ID: " & txt.ID)
- ' MsgBox("Text: " & txt.Text.ToString)
- ' End If
- ' End If
- ' Next
- ' For i As Integer = 0 To e.Values.Count - 1
- ' If e.Values(i) IsNot Nothing Then
- ' e.Values(i) = Server.HtmlEncode(e.Values(i).ToString())
- ' ' MsgBox(Server.HtmlEncode(e.Values(i).ToString()))
- ' End If
- ' Next
- End Sub
- Private Sub DetailsView1_ItemUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DetailsViewUpdateEventArgs) Handles DetailsView1.ItemUpdating
- End Sub
- Private Sub DetailsView1_ModeChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DetailsViewModeEventArgs) Handles DetailsView1.ModeChanging
- If (e.NewMode = DetailsViewMode.Insert) Then
- DetailsView1.ChangeMode(DetailsViewMode.Insert)
- End If
- End Sub
- Protected Sub DetailsView1_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DetailsViewPageEventArgs) Handles DetailsView1.PageIndexChanging
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement