I have a datagrid with an Edit, Update, and Cancel command. The Edit and Cancel commands are working. However, when I click the update link nothing happens. I want the updated information to change and update in the sql database. Can someone please help me?
Sub masterDataGrid_Update(ByVal sender As Object, ByVal e As DataGridCommandEventArgs)
Dim txtUsername As TextBox = e.Item.Cells(2).Controls(0)
Dim txtEvent As TextBox = e.Item.Cells(3).Controls(0)
Dim eventid As Integer = e.Item.Cells(1).Text
Dim EventView As DataView
Dim dtEvent As DataTable
EventView.RowFilter = "Item='" & eventid & "'"
If EventView.Count > 0 Then
EventView.Delete(0)
End If
EventView.RowFilter = ""
Dim dr As DataRow = dtEvent.NewRow()
dr(0) = username
dr(1) = eventid
dr(2) = events
dtEvent.Rows.Add(dr)
masterDataGrid.EditItemIndex = -1
masterDataGrid.DataSource = EventView
masterDataGrid.DataBind()
BindGrid()
End Sub
Sub masterDataGrid_Update(ByVal sender As Object, ByVal e As DataGridCommandEventArgs)
Dim txtUsername As TextBox = e.Item.Cells(2).Controls(0)
Dim txtEvent As TextBox = e.Item.Cells(3).Controls(0)
Dim eventid As Integer = e.Item.Cells(1).Text
Dim EventView As DataView
Dim dtEvent As DataTable
EventView.RowFilter = "Item='" & eventid & "'"
If EventView.Count > 0 Then
EventView.Delete(0)
End If
EventView.RowFilter = ""
Dim dr As DataRow = dtEvent.NewRow()
dr(0) = username
dr(1) = eventid
dr(2) = events
dtEvent.Rows.Add(dr)
masterDataGrid.EditItemIndex = -1
masterDataGrid.DataSource = EventView
masterDataGrid.DataBind()
BindGrid()
End Sub