I have a drop down list in C# asp.net MVC3 razor engine. I need to load values to that dropdownlist from one of my tables in my database and some values are hard coded. So I need to get both kind of values into one dropdown list.
I can do them separately.
This is how my view is :
@Html.DropDownListFor(model => model.MyTransaction.Status, new MultiSelectList(ViewBag.MyStatusId, "ID", "Name"))
My Model where enums are created :
public enum Ntypes{
halfday
casual
}
My Controller :
ViewBag.MyTransaction = db.LeaveTypes.ToList(); //get the table values to drop down
//then even I can get the hard coded values separately ............
ViewBag.MyTansaction = (from NewLeaveTypes t in Enum.GetValues(typeof(Ntypes))
select new { ID = t, Name = t.ToString()).ToList();
But cant get both values into one dropdownlist. Plzzzz Help.
Thanks...........