how to prompt user if they try to delete wrong value
How to prompt user if they try to delete a record from datagrid which
has relationship with other table? I created a editable datagrid and
want to inform user if they try to delete a record that has reletions with other tables. I be happy if some one help me how i can do this in asp.net .Thanks
http://i5.photobucket.com/albums/y18...7/19932c0e.jpg (db reletion ship)
Here is my delete code :
Code:
Private Sub DataGridMatch_DeleteCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles DataGridPlayer.DeleteCommand
[t][t]Dim MyCommand As SqlCommand
[t][t]Dim DeleteCmd As String = "Delete From players Where playerno = " & e.Item.Cells(2).Text
[t][t]MyCommand = New SqlCommand(DeleteCmd, MyConnection)
[t][t]MyCommand.Connection.Open()
[t][t]MyCommand.ExecuteNonQuery()
[t][t]MyCommand.Connection.Close()
[t][t]DataGridPlayer.EditItemIndex = -1
[t][t]BindDataGridPlayer()
[t]End Sub