P
peg
OK here is my problem, i have a datagrid based on a Dataset/SQLDataAdapter
(created based on stored procs already in place)
When i click on the Delete button (built in template delete) in the datagrid
it does delete the record but the datagrid doesn't refresh even tho there is
a DataBind being done. After i click on delete if i refresh the page the
record disappears - i'm at a loss for why this is doing this!
below is my code - thanks in advance!!
Private Sub ClientGrid_DeleteCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs) Handles
ClientGrid.DeleteCommand
Dim key As String = ClientGrid.DataKeys(e.Item.ItemIndex).ToString()
SqlDataAdapter1.DeleteCommand.Parameters("@ClientID").Value =
Convert.ToInt16(key)
Try
If SqlConnection1.State = ConnectionState.Closed Then
SqlConnection1.Open()
End If
SqlDataAdapter1.DeleteCommand.ExecuteNonQuery()
Catch Exp As SqlException
lblMessages.Text = "Error"
End Try
SqlDataAdapter1.Fill(DataSet11)
ClientGrid.DataBind()
SqlConnection1.Close()
End Sub
(created based on stored procs already in place)
When i click on the Delete button (built in template delete) in the datagrid
it does delete the record but the datagrid doesn't refresh even tho there is
a DataBind being done. After i click on delete if i refresh the page the
record disappears - i'm at a loss for why this is doing this!
below is my code - thanks in advance!!
Private Sub ClientGrid_DeleteCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs) Handles
ClientGrid.DeleteCommand
Dim key As String = ClientGrid.DataKeys(e.Item.ItemIndex).ToString()
SqlDataAdapter1.DeleteCommand.Parameters("@ClientID").Value =
Convert.ToInt16(key)
Try
If SqlConnection1.State = ConnectionState.Closed Then
SqlConnection1.Open()
End If
SqlDataAdapter1.DeleteCommand.ExecuteNonQuery()
Catch Exp As SqlException
lblMessages.Text = "Error"
End Try
SqlDataAdapter1.Fill(DataSet11)
ClientGrid.DataBind()
SqlConnection1.Close()
End Sub