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 hussain13 reputationPosted Nov 17, 2015, 12:01 AM EST
Shuvojit HalderRank #2,827 · 503 reputationPosted Nov 16, 2015, 9:30 PM EST
swsh hussain13 reputationPosted Nov 16, 2015, 10:49 PM EST
Shuvojit HalderRank #2,827 · 503 reputationPosted Nov 16, 2015, 11:32 PM EST