Asp.net mvc 4 DropDownList使用viewmodel MVC4返回空值

Asp.net mvc 4 DropDownList使用viewmodel MVC4返回空值,asp.net-mvc-4,viewmodel,html-select,Asp.net Mvc 4,Viewmodel,Html Select,视图模型: namespace CFMembers.ViewModels { public class IndexData { public LicenseHolder LicenseHolders { get; set; } public Installation Installations { get; set; } } } 控制器: public ActionResult Create() { LicenseH

视图模型:

namespace CFMembers.ViewModels
{
    public class IndexData
    {

        public LicenseHolder LicenseHolders { get; set; }
        public Installation Installations { get; set; }

    }
}
控制器:

public ActionResult Create()
{

        LicenseHolder licenseHolder = new LicenseHolder();



        IndexData ViewData = new IndexData
        {
            LicenseHolders = licenseHolder,

        };

        PopulatePartyTypeDropDownList();
        PopulateLicenseHolderTypeDropDownList();
        return View(ViewData);

    }

    //
    // POST: /Main/Create

    [ActionName("Create"), AcceptVerbs(HttpVerbs.Post)]
    public ActionResult CreateSubmit(IndexData viewModel)
    {


        if (ModelState.IsValid)
        {

            db.LicenseHolder.Add(viewModel.LicenseHolders);
            db.Installation.Add(viewModel.Installations);

            db.SaveChanges();
            return RedirectToAction("Index");
        }


        return View();
    }
Create.cshtml

<div class="editor-label">
    @Html.LabelFor(model => model.LicenseHolders.LicenseHolderTypeID, "License Type")
 </div>
 <div class="editor-field">
    @Html.DropDownList("LicenseHolderTypeID", String.Empty)
    @Html.ValidationMessageFor(model => model.LicenseHolders.LicenseHolderTypeID)               
</div>

@在另一个视图中,Html.DropDownList可以正常工作。但是,在具有多个表的viewmodel上不存在这种情况。回发时,LicenseHolderTypeID为0,无论我做什么。我也尝试过dropdownlistfor,但仍然得到0。任何助手都将不胜感激。我想这与viewmodel的传递方式有关,但我被卡住了

我成功了:-在Create.cshtml@Html.DropDownListFor model=>model.LicenseHolders.LicenseHolderTypeID中,选择ListViewBag.LicenseHolderTypeID,licenseholdertypeyes:,选择正确