asp.net mvc 2 - Returning Redirect or PartialView from the same Action -


i have problem ajax.beginform. have form submit , button updates partial view.

what trying accomplish use following return statements in same action.

// button activates return partialview("partialviewname", data); 

and

// submit activates return redirect(model.url); 

now problem redirect causes problems ajax.beginform

<% using (ajax.beginform("action", "controller", new ajaxoptions { onsuccess = "onsuccess", updatetargetid = "container", insertionmode = insertionmode.replace }, new { id = "eventajaxform" })) { %> 

how can identify result partialview or redirecting user?

normally when perform ajax call controller action redirects followed until client gets 200 status code or error. html of url redirecting placed in container div. on other hand in controller action test whether call asynchronous using request.isajaxrequest() , return partial.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

html - Instapaper-like algorithm -

c# - How to execute a particular part of code asynchronously in a class -