0
[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
  • Return url in json and redirect using js Commented Nov 21, 2014 at 14:15

1 Answer 1

0

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.

Sign up to request clarification or add additional context in comments.

7 Comments

He also has to change the return type to ActionResult I believe.
@soner what are you trying to accomplish in the first place? If GetLawDetail is in the same controller that this solution will work, otherwise it won't.
it is in another controller and also another actionresult
no another solution from anybody ? Sometimes i feel i am helpless because of Microsoft . I can not change any code in .net :)
I don't think there is any other solution to return another Action. Although you can create a controller with only one method (the one that's called from javascript) and inherit the controller that has GetLawDetail method so that you can call it as I've described in the answer
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.