0
ساختن IEnumerable DropDownList در Asp Mvc
درود .
دوستان من میخوام که یه IEnumerabel DropDownList بسازم ولی با این کد همش خطا میده . باید چیکار کنم ؟ اگر ممکنه یه کد برای ساختن IEnumerable DropDownList در Asp Mvc بهم بدید ممنون میشم .
Controller : public ActionResult EditStudent() { ViewBag.Reshte = new SelectList(_db.Tbl_Reshte, "ReshteID", "ReshteName"); ViewBag.Paye = new SelectList(_db.Tbl_Paye, "PayeID", "PayeName"); return View(); } View : <div class="form-group"> @Html.LabelFor(x => x.Reshte) @Html.DropDownListFor(x => x.Reshte, (SelectList) ViewBag.Reshte, "-- رشته دانش آموز ---", htmlAttributes: new {@class = "form-control"}) </div> <div class="form-group"> @Html.LabelFor(x => x.Paye) @Html.DropDownListFor(x => x.Paye, (SelectList) ViewBag.Paye, "-- پایه تحصیلی دانش آموز --", htmlAttributes: new {@class = "form-control"}) </div>
1 پاسخ
0
سلام دوست عزیز، چه پیغام خطایی دریافت می کنید؟