1
Answer

GridView Selected Items

To get the ListBox selected Items, i wrote like this . simillarly instead of ListBox i'm using GridView.How to write the same code.In Girdview i have some rows i want to read all the values and store it into a string datatype.



ListBox LstBox = (dgi.FindControl("lstType") as ListBox);
string strselect = "";
 for (int j = 0; j < LstBox.Items.Count; j++)
{
 ListItem li = LstBox.Items[j];
 if (li.Selected)
 {
strselect = strselect + ", " + li.Value;
}
}
Answers (1)