N
NDady via DotNetMonster.com
Hi,
I have a datagrid populated from a dataset. On every row in the grid I have
a delete button. When the user presses on the delete button I remove the
row from the dataset and rebind the datagrid.
The problem is that after a couple of delete the index in the dataset does
not match the index in the grid and the wrong record i deleted from the
dataset. How can I solve this Problem? I am using the following procedure:
Private Sub dg1_ItemCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs) Handles dg1.ItemCommand
If e.CommandName.ToString = "Delete" Then
Dim dset As DataSet
dset = CType(Session("VideoDset"), DataSet)
dset.Tables(0).Rows(e.Item.ItemIndex()).Delete()
dg1.DataSource = dset
Session("videoDset") = dset
dg1.DataBind()
End If
End Sub
Thanks
NDady
I have a datagrid populated from a dataset. On every row in the grid I have
a delete button. When the user presses on the delete button I remove the
row from the dataset and rebind the datagrid.
The problem is that after a couple of delete the index in the dataset does
not match the index in the grid and the wrong record i deleted from the
dataset. How can I solve this Problem? I am using the following procedure:
Private Sub dg1_ItemCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs) Handles dg1.ItemCommand
If e.CommandName.ToString = "Delete" Then
Dim dset As DataSet
dset = CType(Session("VideoDset"), DataSet)
dset.Tables(0).Rows(e.Item.ItemIndex()).Delete()
dg1.DataSource = dset
Session("videoDset") = dset
dg1.DataBind()
End If
End Sub
Thanks
NDady