i am using asp.net mvc3 and i populate a create view using following model
Model
public class CategoryModel
{
public int Id { get; set; }
public string Name { get; set; }
public string URL { get; set; }
public string Description { get; set; }
public string Logo { get; set; }
public bool IsActive { get; set; }
public bool isPopular { get; set; }
public IList<Category> Parentcategories { get; set; }
}
In my create View i populate like this
View
<div class="editor-field">
@Html.DropDownList("parentcategories", new SelectList(Model.Parentcategories.Select(c => c.Name), Model.Parentcategories.Select(c => c.Name)))
@Html.ValidationMessageFor(model => model.Parentcategories)
</div>
now how can i access the selected item in my controller method
Method
[HttpPost]
public ActionResult Create( CategoryModel model , HttpPostedFileBase file)
{
//
}
thanks, Ahsan