In your c# i'm not sure how to code it,
but its not difficult.
So if i provide it in VB maybe you will understand hopefully?
YOUR CODE C#
for each (GridViewRow item in GridView1.Rows)
{
itemName = item.Cells[1].Text;
id.Add(method to get id from database);
}
In VB
For each (GridViewRow item in GridView1.Rows)
itemName = item.Cells[1].Text
id.Add(method to get id from database)
strData = strData & itemName & vbcrlf
Next
SomeLabel.Text = strData