G
Guest
When deleting in a Datagrid, I'm using a Datakey to reference the deletion
since the specific table I'm deleting from doesn't have a index or ID for
each entry.
Sub myDataGrid_Delete(ByVal sender As Object, ByVal e As
DataGridCommandEventArgs)
Dim SelectedRow As String = myDataGrid.DataKeys(e.Item.ItemIndex)
'TODO: Delete the record from the database
Dim strSQL As String = _
"DELETE FROM myTable" _
& "WHERE(my_column_name = " & SelectedRow & ")"
'Rebind the DataGrid
myDataGrid.DataBind()
End Sub
and in my datagrid declaration I've got [...DataKeyField="my_column_name"].
How do I reference the actual text in that cell for the delete command? ANY
help would be appreciated.
since the specific table I'm deleting from doesn't have a index or ID for
each entry.
Sub myDataGrid_Delete(ByVal sender As Object, ByVal e As
DataGridCommandEventArgs)
Dim SelectedRow As String = myDataGrid.DataKeys(e.Item.ItemIndex)
'TODO: Delete the record from the database
Dim strSQL As String = _
"DELETE FROM myTable" _
& "WHERE(my_column_name = " & SelectedRow & ")"
'Rebind the DataGrid
myDataGrid.DataBind()
End Sub
and in my datagrid declaration I've got [...DataKeyField="my_column_name"].
How do I reference the actual text in that cell for the delete command? ANY
help would be appreciated.