I have this code here, I am trying to output the contents of a combobox, to my label. But I get an error that I cannot convert char to System.Web.UI.WebControls.ListItem
foreach (ListItem mine in ListSitesDropDownBox.Items)
{
Mylabel.Text += mine.Value.ToString() + " " + mine.ToString() + "<br>";
}
How would you suggest I go about doing this so that I can output the value and name of the list item?
Thanks
You want the
Textproperty of mine in the second part.Here’s the MSDN reference for ListItem. Also
ToStringis unnecessary forValueas it is already astring.