drop down list:
@Html.DropDownListFor(m => m.SelectedCategoryId, new SelectList(Model.AllCategories, "Id", "Name"))
The category value will end up the value of the hidden variable in this case:
@ViewBag.Category
@Html.Hidden("Category")
Otherwise here is a name first, value second way of writing a hidden variable:
@Html.Hidden("Foo","Bar")
No comments:
Post a Comment