Populate DropDown From a Function

Posts   
 
    
lotek
User
Posts: 56
Joined: 14-Sep-2005
# Posted on: 14-Sep-2005 22:03:43   

I am populating with an entitycollection from a function. Currently my code looks like this.


public IList populateDropDown_Pages()
{
     EntityCollection ec = new EntityCollection(new EntityFactory());
     adapter.FetchEntityCollection(adminPages, null, 0, sortExpression);    
     return adminPages;
}

The above code seems to work but i also need an empty value in the dropdown. Typically i would go ddl.Items.Insert(0, "something"), but in this case i don't have access to the control directly. Is there someway i can add an empty row to the collection instead?

Thanks Matt

bclubb
User
Posts: 934
Joined: 12-Feb-2004
# Posted on: 15-Sep-2005 02:16:25   

Can you add the insert to the portion of your program that is calling this function? You can add an entity to a collection, but I would think that adding it directly to your dropdown would be a better solution since you can control where it is in your dropdown easier.