MVC :: How To Redirect From Action To Another Action

Feb 3, 2011

I have a page with three partial views. On the first ascx, I want some data posted when a user clicks on "submit" button, and send that data to another POST action "search" and search the db with that data, the final output should be the view returned by "search". How do I do this?

View 3 Replies

Similar Messages:

MVC :: Redirect Action Not Working In Jqgrid Action Results Method

Mar 23, 2011

I am desiging a master and details page from a search page..user can search for something and I need to display the result in jqgrid if the result has more than 1 row or record.. if the result is just one record then i have to directly send then to details page by skiping grid page... I do have an action method for results page and one more action method for Jqgrid data..i am trying to check the row count for the database result and trying to redirect to details action results..but its not working at all..and showing an empty jqgrid..


View 9 Replies

MVC :: Why Synchronous Action Wasn't Executed Until Asynchronous Action Completed

Nov 29, 2010

I'm implement Comet in MVC, I used timer to keep Async request in server, Async request will complete when timer elapsed 1 minute and response to client (to avoid 404 error) and then reconnect to Async Controller. I also wanna execute some Synchronous action during Async request was holding, but the problem is: When an Async action was executed and hold by using timer, the Sync Action wasn't called until Async action (comet long-live request) completed. I did test with firefox 3.6 many times, but the result is the same, so strange, Do you know why ? I have a sub some questions : To implement comet, using timer (response after some minutes elapsed) or thread (response after several time sleeping thread) to hold async request, which is better?

View 1 Replies

Test That A Controller Action Simply Returns A Link To Another Action?

Apr 29, 2010

Lets say I have a simple controller for ASP.NET MVC I want to test. I want to test that a controller action (Foo, in this case) simply returns a link to another action (Bar, in this case).How would you test TestController.Foo? (either the first or second link)

My implementation has the same link twice. One passes the url throw ViewData[]. This seems more testable to me, as I can check the ViewData collection returned from Foo(). Even this way though, I don't know how to validate the url itself without making dependencies on routing.The controller:

public class TestController : Controller
public ActionResult Foo()[code].....

View 1 Replies

MVC :: Create Action Not Carrying Model Across To Http Action

Jun 12, 2010

My httppost action doesnt seem to have received my model. The code is below;


i put a breakpoint on the line; return RedirectToAction("Error", "Dashboard"); and i found that appQualif carried no values whatsoever from the form i submitted..

View 5 Replies

MVC :: Redirect To Action By Jquery?

Apr 8, 2010

how can i redirect to an action by jquery

View 2 Replies

How To Pass Parameters To An Action Using Html.Action() In MVC?

Jun 30, 2010

I've been using Html.Action("ActionName", "ControllerName") to invoke child actions across controllers without needing to have the view in ViewsShared. This has been working great for displaying things like session or cookie information.

Instead of just accessing cookies, I would like to pass additional parameters to Html.Action("ActionName", "ControllerName") so the action can execute different code based on the the data passed to the original view.

Should I be using a different method to pass parameters to a child action in a different controller?

View 1 Replies

MVC :: Controller Invokes GET Action Instead Of POST Action

May 20, 2010

I'm trying to add file upload functionality to a page. I've got a form that posts the selected file to a controller with a 'savefile' method. But if I don't add a get version of 'savefile' I'll get a 404 error. Here is the form code which is presented on the Index page:


And here is the controller code:


Intuitively I don't think I should need a GET version of SaveFile but if omit it I get a 404 error when the form posts. Why should I need a GET version of SaveFile when all I want is to post a form and save the file?

View 4 Replies

MVC :: Dynamically Adding Action Filter To Action?

Jun 21, 2010

Does any one know how to dynamically add ActionFilter to an Action?

View 3 Replies

How To Perform A Javascript Action Right After Redirect

Mar 9, 2011

After a user creates an account on my website, I want to redirect the user to the home page and display a twitter style message bar on top. This is how I have it:

success: function (response) {
if (response.Success) {
location.href = response.ReturnUrl;

The message bar does appear but it gets displayed only for a second as it gets canceled by the redirect. What can I do to display the message right after the redirect has completed? Is there a complete event for the location.href?

View 6 Replies

MVC :: Redirect To Post Method/Action?

Mar 28, 2011

I have an ActionResult that accepts POST, however is there a work around for me to redirect from a controller to another controller containing this POST method/action?

View 3 Replies

MVC :: Unable To Redirect To Action When Posting With Json?

Nov 8, 2010

I originally have the question posted here, but I need as many eyes as possible on it.Essentially, I'm having issues redirecting to an action in mvc2 when working with JSON data. I post a stringified JSON object to an action and the action in turn redirects as needed. It worked previously when using form fields, but not when I'm posting JSON. To get posted JSON objects to properly bind to parameters objects in MVC, I'm taking advantage of the JsonValueProviderFactory class from MVC2Futures/MVC3Beta.Why is this occuring? The jQuery ajax call is telling the server "I'm giving you json, I expect html in return" and all actions pointed to via RedirectToAction calls are structured in a similar manner. I instead get stuck in a loop, continually hitting the originally requested action, with a prompt to reenter authorization information to boot! It seems lose authentication/authorization information in the process.The linked question on

View 4 Replies

C# - Redirect User Back To The Original Action After Login

Jan 26, 2011

The sequence of actions that I am trying to accomplish is below.

Context: user can add products to its own account.

User tries to add a specific product. (He/she is not login at this point.

In the code behind, I need to redirect the user to login page before I can add the product to user's account.

After login, how do I take the system back to the logic to finish up the action in step 1.

View 2 Replies

Redirect ALL Ajax Requests(with X-Requested-With:XMLHttpRequest In Header) To Action?

Sep 16, 2010

i want redirect ALL ajax requests(with X-Requested-With:XMLHttpRequest in header) to action: ajax(string function, string args) . How can i do it?For example: browser send ajax query with paramerts function=getImage&args=4 to url http://localhost/post/123 but we redirect query to http://localhost/ajax.

View 2 Replies

MVC :: Determine Which Action Invoked Particular Action?

Nov 12, 2010

I have a controller with a bunch of actions as such:


I'm looking for a way to find out which action invoked the other: for instance, when redirecting to Action1, I need to know whether it is coming from clicking "next" button at Action0 or clicking "back" button at Action2. This is is to avoid performing Action1 twice (My app is like a wizard, if I click back button at Action2, I don't want to execute Action1 again).

View 1 Replies

How To Tell Create Button To Send To An Action Named Create And To Edit To An Action

Mar 14, 2010

I'm a newbie into MVC and I am like only on chapter 7 in ASP.NET MVC Unleashed so be easy with m


how do I tell Create Button to send to an Action named Create and to Edit to an Action named Edit on the same form?I guess it is possible on ASP.NET MVC if it is possible on ASP.NET Webforms

View 6 Replies

MVC :: How To Call One Action From Another Action

Mar 31, 2010

I have a view MemberProfile like this

<% using (Html.BeginForm()
{ %>
<p>FirstName :<%=Html.TextBox("FirstName", Model.FirstName) %></p>
<p>Last Name : <%=Html.TextBox("LastName", Model.LastName)%></p>

View 1 Replies

MVC :: Action Method Returning An ActionResult Used In A Action Method?

Aug 27, 2010

I have the Index action method calling a method that itself is an action method.

Example :


What to do in this case ?

View 10 Replies

MVC :: Two Different Action With The Same Name?

Sep 28, 2010

I have two actions with the same name:


I think everything clear here. But I don't like that parameter int k which I never use and which I pasted in order to create another function which will be launched when some data was posted to that action.

View 2 Replies

MVC :: Images Don't Appear If The Action Isn't Specified In The Url ?

Jul 29, 2010

I have a problem, whereby if I browse to a page using a url of the form: site/home.mvc/Index where Index is an action on the Home controller, my page displays as I would expect.

However, if I browse to site/home.mvc the page loads, all except for my images which are replaced by red crosses.

View 3 Replies

MVC :: How To Get A Preview Action

Oct 28, 2010

there is an Account/SignOut link in Home/Index page,if i click this link ,in action SignOut,how to get the preview action Home/Index?

View 2 Replies

C# - MVC Action With ApplicationPath?

Mar 20, 2010

i'm creating a mvc application and i'll use under subdomain like

This subdomain is pointing to app subdirectory, but my actions are always generated with applicationPath (subdirectory) like:
// I want just this without additional paths
Is there any configuration related to this?
Is this the correct way to generate links?
<%= Html.ActionLink("About", "About", "Home") %>

View 2 Replies

MVC: How To Get The Previous Action Name

May 6, 2010

I can get the current action name by using the following code

var currentActionName = ControllerContext.RouteData.GetRequiredString("action");

but is it possible to get the previous action name as well?

View 1 Replies

Mvc - How To Set Action Explicitely

Feb 7, 2010

I have 2 views for a input operation in my application.

The first view (lets call it view1) submits a form. Based on the form some operations on database is done and second view(View2) is returned with some other data from the database as a model.

controller action code :

public ActionResult View1(FormCollection fc)
//database ops to fill vm properties
View2ViewModel vm=new View2ViewModel();
return View("View2", vm);

Now, since I return a new view and not a action redirect the url is still http://url/View1 but everything works as it is supposed to.

The problem:

When I submit the form in View2 it calls the View1 action method, not the View2 action method. Probably because the url is still View1. What can I do to call the action View2

View 3 Replies

MVC :: Url Becomes Wrong When Using Id On Action?

Jan 12, 2010

I have the following in my JQuery code:

icon.image = "../Contents/Image/GoogleMapMarker_Icon.png";

This works fine when I am on the url:


But if I pass an Id to the action and get the following url:


The image is not loaded and I get a 404 error. I was checking with with Firebug and I get:


Instead of:


View 7 Replies

Copyrights 2005-15, All rights reserved