sconard

sconard

  • NA
  • 6
  • 0

using object to load dropdown error is "It must be either an IListSource, IEnumerable, or IDataSource."

May 7 2012 2:30 PM
What syntax do I use to load dropdown with an object?

IE I have a class "project". The method "LoadAll" loads "project" with thirty projects

Project object has a idProject parameter and a projectName

            project objProj = new project();
            objProj.LoadAll();

            DropDownList ddTemp = new DropDownList();
            
            ddTemp.DataSource = objProj;
            ddTemp.DataValueField = "idProject";
            ddTemp.DataTextField = "projectName";
            ddTemp.DataBind();


error is "It must be either an IListSource, IEnumerable, or IDataSource".


Answers (2)