sorenaus
شنبه 22 آبان 1389, 16:55 عصر
با سلام
من در Post برای پر کردن DropDownList مشکل دارم، لطفا راهنمایی کنید
//
// GET: /Panel/Create
public ActionResult Create()
{
var group = from g in panel.tblGroups
select g;
ViewData["groupList"] = group;
return View();
}
//
// POST: /Panel/Create
[HttpPost]
public ActionResult Create([Bind (Exclude="id")]tblNew m)
{
try
{
panel.tblNews.InsertOnSubmit(m);
panel.SubmitChanges();
return RedirectToAction("Index");
}
catch
{
return View();
}
}
<%: Html.DropDownList("groupList", new SelectList((IEnumerable)ViewData["groupList"], "GroupID", "GroupName"))%>
با تشکر
من در Post برای پر کردن DropDownList مشکل دارم، لطفا راهنمایی کنید
//
// GET: /Panel/Create
public ActionResult Create()
{
var group = from g in panel.tblGroups
select g;
ViewData["groupList"] = group;
return View();
}
//
// POST: /Panel/Create
[HttpPost]
public ActionResult Create([Bind (Exclude="id")]tblNew m)
{
try
{
panel.tblNews.InsertOnSubmit(m);
panel.SubmitChanges();
return RedirectToAction("Index");
}
catch
{
return View();
}
}
<%: Html.DropDownList("groupList", new SelectList((IEnumerable)ViewData["groupList"], "GroupID", "GroupName"))%>
با تشکر