How to loop through rows in Datalist control?
I know how to edit one line in the Datalist. For example,
Item Quantity
Update Skirt 20
But I don't know how to update if more than one line. For example,
Item Quantity
Skirt 20
Dress 10
Jacket 10
Update
After the user clicks Update, I want to loop through it and insert into a table line by line . I tried to use intIndex instead of e.Item.ItemIndex, but it boomed at strItem = tbox.Text.ToUpper. Is it possible to loop through it? If so, can you please help? Thanks.
Private Sub dblRoleItemNew_UpdateCommand(ByVal sender As System.Object, ByVal e As System.Web.UI.WebControls.DataListCommandEventArgs) _
Handles Datalist1.UpdateCommand
Dim tbox As TextBox
Dim intItemID, strItem, tbox1, insertSQL As String
Dim intIndex As Integer
For intIndex = 0 To Session.Item("TotalItems") - 1
intItemID = Datalist1.DataKeys(intIndex).ToString
'find the textbox control containing the menu item security
tbox = DirectCast(Datalist1.FindControl("txtItem"), TextBox)
strItem = tbox.Text.ToUpper
insertSQL = “……”
Next
End Sub
Dan-Yeung