Asp.net mvc return to controller from jsonresult

596 views Asked by At
[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...
}

Instead of return Json(apptype, JsonRequestBehavior.AllowGet); how can i write below ?

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

If anybody wants to see 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) {
                    }

                            ....
                            ..

How can i return to Law controller to GetLawDetail actionresult inside of jsonresult ?

1

There are 1 answers

7
Vsevolod Goloviznin On

You can just return this action:

return GetLawDetail(baseappid)

You should also change the return type to Action result as pointed by @im1dermike.

Here's the complete code:

[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...
}

Although, it will return you the whole rendered page.