I tried my code as follows
I am dsiplaying gridview selected row data into listbox.
In gridview run mode as follows
select (header text) AVailable dates
select (button) 27 may 2015
select(button) 30 may 2015
When i select the above two from the girdview. i want to display two selected rows values t listbox.
protected void gvPkgcbndate_SelectedIndexChanged1(object sender, EventArgs e)
{
foreach (GridViewRow row in gvPkgcbndate.SelectedRow)
{
lbllist.Items.Add(row.Cells[0].Text.ToString() + " " + row.Cells[1].Text.ToString());
}
}
In listbox i want output as follows
27 may 2015
30 may 2015
i tried but show error as follows
foreach statement cannot operate on variables of type 'System.Web.UI.WebControls.GridViewRow' because 'System.Web.UI.WebControls.GridViewRow' does not contain a public definition for 'GetEnumerator'
how to solve my error. please help me.