Click here to Skip to main content
16,017,638 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
@{ var comp = new TDSProject.DataContext.TDSDataBase();
IEnumerable<SelectListItem> item = comp.CompanyMaster.ToList().Select(c => new SelectListItem
{
Text = c.CompanyName+" [ "+c.PANNo+" ] ",
Value=c.ID.ToString()
});
ViewBag.com = item;
}
@Html.DropDownListFor(model => model.Comp_ID,item,"----Select----")
@Html.ValidationMessageFor(model => model.Comp_ID)
This is the code I've written in the controller.
Posted
Comments
F-ES Sitecore 14-Dec-15 7:40am    
Do you mean you want to remember the value to use on later pages? If so store it in the Session. Google "c# using session" for examples if you don't know how.
Member 11392252 14-Dec-15 7:47am    
I'm trying to session but I don't know how to use it.

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