After clicking on create button without selecting any data i got an error
There is no ViewData item of type 'IEnumerable' that has the key 'CostCenterId'."}
this my contrller action method
public ActionResult Create()
{
ViewBag.Currency = new SelectList(db.Currencys, "Id", "Currency");
ViewBag.CostCenterId = new SelectList(db.CostCenterIds, "Cost_Center_Id", "Cost_Center_Name");
return View();
}
@Html.LabelFor(model => model.CostCenterId)
@Html.DropDownListFor(model => model.CostCenterId, (SelectList)ViewBag.CostCenterId, "Select ", new { style = "width:200px" })
@Html.ValidationMessageFor(model => model.CostCenterId)
@Html.LabelFor(model => model.Currency)
@Html.DropDownListFor(model => model.Currency, (SelectList)ViewBag.Currency, "Select ", new { style = "width:200px" })
@Html.ValidationMessageFor(model => model.Currency)
swsh hussainPosted Nov 17, 2015, 5:01 AM
Shuvojit HalderPosted Nov 17, 2015, 4:32 AM
swsh hussainPosted Nov 17, 2015, 3:49 AM
Shuvojit HalderPosted Nov 17, 2015, 2:30 AM