3
Answers

foreach statement cannot operate on variables of type 'System.Web.UI.WebControls.ListItem' because '...

Ask a question
adithya dugyala

adithya dugyala

16y
24.4k
1

Hashtable htmodules = new Hashtable();

for (int b = 0; b <= Checkboxlist.Items.Count - 1; b++)

{htmodules.Add(Checkboxlist.Items[b].ToString(), "False");}

foreach (object objModules in Checkboxlist.SelectedItem )

//im getting an error here  foreach statement cannot operate on variables of type 'System.Web.UI.WebControls.ListItem' because 'System.Web.UI.WebControls.ListItem' does not contain a public definition for 'GetEnumerator'

{ htmodules[objModules.ToString()] = "True";}

can any one help me up please its very urgent


Answers (3)