loop through multiple selection listbox
Posted on 2013-02-04
I need to loop through a multiple selection listbox and retrieve selected values.
Three rows were selected. The following code goes to the first selected valuethree times.
string strItems = "";
foreach (ListItem row in lstKeyword.Items)
if (row.Selected == true)
strItems = strItems + int.Parse(lstKeyword.SelectedValue.ToString()) + ",";
//strItems returns 1267,1267,1267,
How can I move to the next selected value?