HashemMaya
جمعه 28 اسفند 1394, 10:16 صبح
سلام دوستان
@Ajax.ActionLink("حذف", "Delete", @item.Id, new AjaxOptions { Confirm = "آیا مطمئن هستید؟", HttpMethod = "Post",OnSuccess="Deleted"})
از این استفاده میکنم برای ارسال مقادیر به اکشن Delete ولی مقادیر به اکشن ارسال نمیشه و اکشن فراخونی نمیشه
اینم اکشنم
[HttpPost]
public ActionResult Delete(int Id)
{
var mydata = new { id = -1 };
if (Request.IsAjaxRequest())
{
Models.BLStudents blstudent = new Models.BLStudents();
if (blstudent.Delete(Id))
{
mydata = new { id = Id };
}
}
else
{
RedirectToAction("List");
}
return Json(mydata, JsonRequestBehavior.DenyGet);
}
اینم قسمت Bundle های پروژه
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
"~/Scripts/jquery-ui-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/unobtrusive").Include(
"~/Scripts/jquery.unobtrusive*"));
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
"~/Scripts/jquery.unobtrusive*",
"~/Scripts/jquery.validate*"));
// Use the development version of Modernizr to develop with and learn from. Then, when you're
// ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
"~/Scripts/modernizr-*"));
لطفا اگه کسی میدونه راهنمایی کنه:متفکر:
@Ajax.ActionLink("حذف", "Delete", @item.Id, new AjaxOptions { Confirm = "آیا مطمئن هستید؟", HttpMethod = "Post",OnSuccess="Deleted"})
از این استفاده میکنم برای ارسال مقادیر به اکشن Delete ولی مقادیر به اکشن ارسال نمیشه و اکشن فراخونی نمیشه
اینم اکشنم
[HttpPost]
public ActionResult Delete(int Id)
{
var mydata = new { id = -1 };
if (Request.IsAjaxRequest())
{
Models.BLStudents blstudent = new Models.BLStudents();
if (blstudent.Delete(Id))
{
mydata = new { id = Id };
}
}
else
{
RedirectToAction("List");
}
return Json(mydata, JsonRequestBehavior.DenyGet);
}
اینم قسمت Bundle های پروژه
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
"~/Scripts/jquery-ui-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/unobtrusive").Include(
"~/Scripts/jquery.unobtrusive*"));
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
"~/Scripts/jquery.unobtrusive*",
"~/Scripts/jquery.validate*"));
// Use the development version of Modernizr to develop with and learn from. Then, when you're
// ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
"~/Scripts/modernizr-*"));
لطفا اگه کسی میدونه راهنمایی کنه:متفکر: