Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DATAGRID

Status
Not open for further replies.

adamdavies

Programmer
May 21, 2003
20
AU
DELETING A ROW IN DATAGRID

ASP.NET CODE

Sub DataDelete(ByVal Sender As Object, ByVal E As DataGridCommandEventArgs)
Dim deletekey As String
If dgusers.EditItemIndex = -1 Then
deletekey = dgusers.DataKeys(CInt(E.Item.ItemIndex))
Labeldescript.Text = ("Key Field " & deletekey & " Deleted")
BindSQL()
Else
Response.Write("Can't delete until editing is done!")
End If
End Sub

HTML CODE

OnDeleteCommand="DataDelete" DataKeyField="CompanyID"

No errors, it says it has removed the keyfield but still not deleting

thanks
adam
 
Hmmm...maybe you need to add:

Sub DataDelete(ByVal Sender As Object, ByVal E As DataGridCommandEventArgs) Handles DataGrid.DeleteCommand

D'Arcy
 
Do you use the Handles DataGrid.DeleteCommand instead of adding the line in the HTML that points to the sub from the datagrid's block?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top