c# - Redirect from controller during an Ajax.Actionlink call -
i'm trying redirect controller during middle of ajax.actionlink call. have ajax.actionlink so:
@ajax.actionlink("send project", "registerajax", "projects", new {id = model.incidentid}, new ajaxoptions {httpmethod = "post", updatetargetid = "projectmsg_" + model.incidentid})
then in controller, have following:
public actionresult registerajax(int id = 0) { string result = registerproject(id); if (result != null) { return redirectresult(result); } return content("sent..."); } private actionresult redirectresult(string result) { throw new notimplementedexception(); }
if result != null
, i've tried above, return redirect(result)
, return view(result)
, etc. , nothing gets me redirected result page (e.g. ~/views/manage/location.cshtml). i've verified result returning path (by returning in return content(result)
) . however, when click on hyperlink (i.e. ajax.actionlink), unresponsive, i've verified it's doing in background except redirect.
anyone know trick? many thanks.
it sounds don't need ajax, , might better off using normal html form post action. should able redirect within action handles posting. there reason believe need ajax in scenario?
Comments
Post a Comment