Link to home
Start Free TrialLog in
Avatar of bolt81
bolt81Flag for United Kingdom of Great Britain and Northern Ireland

asked on

Collect datakeys from datalist when looping thorugh rows

hi

i have made a datalit that shows a list of items with a text box next to each item. i want to be able to enter a value into each text box and then have the user click one button "Update all" and it to then update all the record that are shown.

each row is one record.

i have started to do this by using the code below to loop thorugh each row and collect the text box.

i also need to collect the datakey whch is defined in the datalist so that i can update the correct record.

i have used this code from a tutorial online but now i am unable to get it to work
Protected Sub SaveAll_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles SaveAll.Click
        Dim dlitem As DataListItem
        Dim installed As TextBox
        Dim itemID As Integer
 
        For Each dlitem In DataList1.Items
            installed = CType(dlitem.FindControl("Installedtext"), TextBox)
            itemID = Convert.ToInt32(DataList1.DataKeys[Items.itemindex])
 
        Next
 
    End Sub

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of prairiedog
prairiedog
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bolt81

ASKER

thanks i should have seen that