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

Popular posts from this blog

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

python - How to remove the Xframe Options header in django? -