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

Sep 23 2008 1:37 AM

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)