Asp.net mvc从jsonresult返回控制器

时间:2014-11-21 13:55:28

标签: c# asp.net-mvc jsonresult

[HttpPost]
public JsonResult DelayReminder(string reminderId)
{
ReminderStatus rs = new ReminderStatus();


rs.BaseProps.RequesterUserInfo.UserID = SessionManager.Current.CurrentUser.UserID;


ReminderServiceHelper.InsertNewStatus(Convert.ToInt32(reminderId), rs);

return Json(apptype, JsonRequestBehavior.AllowGet); // Problem...
}

而不是返回Json(apptype,JsonRequestBehavior.AllowGet); 我如何在下面写?

return RedirectToAction("GetLawDetail", "Law", new { _lawID = baseappid });

如果有人想看Javascript:

 $.ajax({
                    type: 'POST',
                    url: '/Reminders/DelayReminder/',
                    data: {
                        'apptype': '@ViewData["apptype"]',
                        'baseappid': '@ViewData["baseappid"]',
                        'reminderId': $("#reminderId").val(),
                        'ddlDelayDuration': $("#ddlDelayDuration").val()
                    },
                    dataType: 'json',
                    success: function (result) {

                        if (result != null) {
                    }

                            ....
                            ..

如何在jsonresult内部返回 Law controller to GetLawDetail actionresult

1 个答案:

答案 0 :(得分:0)

您可以退回此操作:

return GetLawDetail(baseappid)

您还应该将返回类型更改为@ im1dermike指向的Action结果。

这里是完整的代码:

[HttpPost]
public ActionResult DelayReminder(string reminderId)
{
ReminderStatus rs = new ReminderStatus();


rs.BaseProps.RequesterUserInfo.UserID = SessionManager.Current.CurrentUser.UserID;


ReminderServiceHelper.InsertNewStatus(Convert.ToInt32(reminderId), rs);

return GetLawDetail(apptype); // Problem...
}

虽然,它会返回整个渲染页面。