Example for guidance:
I think the best way to achieve what you're after would be to use a ViewModel
. You'd load the stuff you want to display in your View through this. So you'd create a dropdownlist with your accountlist which will be loaded in your controller. You'll also have your IEnumerable PErsoncontact in there which will also be loaded in your controller. Then your controller will pass the ViewModel to the View. You can use this as a guide.
ViewModel:
public class PersonViewModel
{
public int PersonID {get;set;}
public List<SelectListItem> PersonContactList {get;set;}
public IEnumerable<TypesAvail> TypesAvails{get;set;}
}
Dropdownlist in Razor View :
@Html.DropDownListFor(m => m.PersonID , Model.PersonContactList )
Edit:-
This is an example .Yes you can create a new class in same Model.
public class TypesAvail
{
public String TypeNme { get; set; }
public long TypeID { get; set; }
public int NumSelected { get; set; }
public int TypeCount { get; set; }
public IEnumerable<SelectListItem> CarsAvail
{
get
{
return new SelectList(
Enumerable.Range(0, TypeCount+1)
.OrderBy(typecount => typecount)
.Select(typecount => new SelectListItem
{
Value = typecount.ToString(),
Text = typecount.ToString()
}), "Value", "Text");
}
}
}
Dropdownlist in Razor View :
@Html.DropDownListFor(m=> m.NumSelected, Model.CarsAvail)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…