asp.netvb.netlistgridview

Select value of list in the gridview edit button row


I originally had a gridview edit column that would allow me to edit the specific value in the row. I actually am not allowed use a datatable as an object however and converted my values into a list of objects. My question is, how can I convert my previous code:

Dim rowOfCustomers = GridView1.Rows(e.NewEditIndex)
sCompany = dtCustomer.Rows(rowOfCustomers.DataItemIndex)("Company")
sContact = dtCustomer.Rows(rowOfCustomers.DataItemIndex)("Contact")
sAddress1 = dtCustomer.Rows(rowOfCustomers.DataItemIndex)("Address1")

Into something I can use with my list. Maybe something along the lines of (except for the rowOfCustomer.DataItemIndex part):

sCompany = listOfCustomer.IndexOf(rowOfCustomers.DataItemIndex)("Contact")

Solution

  • I figured out how to grab the index and item value.

    sCompany = listOfCustomers.Item(rowIndex).Company
    sContact = listOfCustomers.Item(rowIndex).Contact
    sAddress1 = listOfCustomers.Item(rowIndex).Address1