من می خواستم از کنترلر لیستی از جدول منو رو به ویو بفرستم اما ارور زیر رو می گیره ....چطور می تونم این مشکل رو برطرف کنم؟
با تشکر
The model item passed into the dictionary is of type 'System.Collections.Generic.List`1[NMC.Models.Menu]', but this dictionary requires a model item of type 'NMC.Models.Menu'.
کد در کنترلر
public ActionResult TopMenu() { IEnumerable <Menu> result_Menu =db.Menu.ToList(); return View(result_Menu); }
کد در ویو
@model IEnumerable<NMC.Models.Menu> @foreach (var item in Model) { @item.Menu_MenuTitle }
هیچ کاربری تا کنون از این پست تشکر نکرده است
با ما تماس بگیرید تا در این مسیر همراهتان باشیم :)