Click here to Skip to main content
15,887,992 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
add text & value property from it

What I have tried:

public List<clusterclass> objDllColl = new List<clusterclass>();

public class ClusterClass
{
public ObservableCollection<SelectListItem> Parameters { get; set; }
public string MCLELDescription { get; set; }
}


for (int i = 0; i < objds.Count(); i++)
{
objDllColl.Add(new ClusterClass
{
MCLELDescription = objds[i].Description,
Parameters = objDllColl.Add(new SelectListItem { Text = "", Value = ""}),
});
}

//Parameters.Add(new SelectListItem
//{
// Text = "company_Code",
// Value = System.Web.HttpContext.Current.Session["iCompanyCode"].ToString(),
//});
Posted
Updated 15-Mar-16 1:02am
Comments
[no name] 15-Mar-16 5:26am    
Please describe your question more..
Sathish km 15-Mar-16 6:19am    
add data to SelectListItem(Text & Value )
John C Rayan 15-Mar-16 5:27am    
I think you are confused yourself. What is your requirement. Can you explain.
You need to identify your value (id usually) and text (description text usually) and then create a select list.
Sathish km 15-Mar-16 6:19am    
add data to SelectListItem(Text & Value )
John C Rayan 15-Mar-16 6:34am    
Where are the text and value values

1 solution

I would strongly recommend to go through this article.

Creating a DropDownList for Enums in ASP.NET MVC[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900