How to Delete Items in a DataGrid Web Server Control

T

tom c

In this walkthrough on "Allowing Users to Delete Items in a DataGrid
Web Server Control" at:

ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/vbcon/html/vbtskallowinguserstodeleteitemsindatagridwebcontrol.htm

it leaves out some very important code. Here is what it gives you:

' Visual Basic
Private Sub DataGrid1_DeleteCommand(ByVal source As Object, _
ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) _
Handles DataGrid1.DeleteCommand
Dim index As Integer
index = e.Item.ItemIndex
' Add code to delete data from data source.
DataGrid1.DataBind()
End Sub

Where is says "Add code to delete data from data source" I have no idea
what to add. Can someone tell me what goes there, or point me to a
walkthough or example that goes into more detail?
 
B

Bruno Alexandre

LOL...

it says: Add code to delete data from data source

so, add the code to delete the row you what! How easy could it be?
it give you the ID from that row in the index variable... if your data is in
the database use something like

"DELETE FROM table WHERE idRow = @index"
and bind the parameter @index to the index variable

....
r u using 1.x or 2.0?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top