Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > How to Delete Items in a DataGrid Web Server Control

Reply
Thread Tools

How to Delete Items in a DataGrid Web Server Control

 
 
tom c
Guest
Posts: n/a
 
      06-07-2006
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/vbtskallowinguserstodeleteitemsindatagridwebcontro l.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?

 
Reply With Quote
 
 
 
 
Bruno Alexandre
Guest
Posts: n/a
 
      06-08-2006
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?

--

Bruno Alexandre
(a Portuguese in Københanv, Danmark)


"tom c" <(E-Mail Removed)> escreveu na mensagem
news:(E-Mail Removed) ups.com...
> 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/vbtskallowinguserstodeleteitemsindatagridwebcontro l.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?
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
DataGrid.Items.Count and DataGrid Paging... Green Start Button ASP .Net 2 08-02-2006 02:01 AM
Any way to reorder how a datagrid is drawn (header/footer/items vs.header/items/footer)? Henrik ASP .Net Datagrid Control 1 07-06-2006 12:23 AM
Delete key doesn't delete when datagrid is bound to a disconnected table Fred Zolar ASP .Net Datagrid Control 0 04-01-2004 07:47 AM
HTML Client Control versus. HTML Server Control versus. Web Server Control Matthew Louden ASP .Net 1 10-11-2003 07:09 PM



Advertisments