cant get my listbox to display objects
- by Silvia Stoyanova
Hello everyone I've been trying to put some objects in an ASP.NET list box but its just not working.
I do have an overriden ToString method so I cant understand why this statement wont work.
Here's the code that I use:
for (int i = 0; i < fitnessClassList.Count(); i++)
{
lbDisplayItems.Items.Add(fitnessClassList.getFitnessClass(i));
}
And the errors that I get:
Error 2 Argument 1: cannot convert from
'FitnessClassManager.FitnessClassOpportunity' to
'System.Web.UI.WebControls.ListItem'
Error 1 The best overloaded method match for
'System.Web.UI.WebControls.ListItemCollection.Add(System.Web.UI.WebControls.ListItem)'
has some invalid arguments