Deleting Items in a DataGrid

B

baGo

Hi all,

i use this code taken from MSDN at the address:

http://msdn.microsoft.com/library/d...indatagridordatalistwebcontrolvisualbasic.asp

01 Private Sub DataGrid1_DeleteCommand(ByVal source As Object, _
02 ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs) _
03 Handles DataGrid1.DeleteCommand
04 Dim customerid As String
05 Dim l As Label
06 l = CType(e.Item.FindControl("Label1"), Label)
07 If (Not l Is Nothing) Then
08 customerid = l.Text
09 Dim customerid As String = e.Item.Cells(3).Text
10 Dim dr As DataSet1.CustomersRow
11 dr = DataSet11.Customers.FindByCustomerID(customerid)
12 dr.Delete()
13 SqlDataAdapter1.Update(DataSet11)
14 DataGrid1.DataBind()
15 End If
16 End Sub

well it work's great but i don't understand very well the code.

Why there're two declaration of "customerid"?
What's means line 6 and 9?????


thank's All
 

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

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top