Link to home
Start Free TrialLog in
Avatar of ToString1
ToString1

asked on

ASP.NET MVC - How to route to another controller actionResult

I have MVC2 app split into different areas.

In the root I have a view called verifyCustomer.   I want this view when submitted to go to the controller action DetermineBandResult in the TeamAdmin controller which is in another area of the app.

Like tihs

 <% using (Html.BeginForm("DetermineBandResult", "TeamAdmin", new { id = User.Id}, FormMethod.Post, null))

Now when I submit it says that the view DetermineBandResult in TeamAdmin does not exist.    Do I have to create a view specifically for the action result?   I want it to do some processing then route to another view, so rso really I don't need a view called DetermineBandResult

Is this the correct approach?
Avatar of Craig Wagner
Craig Wagner
Flag of United States of America image

I don't think the problem is with your BeginForm call, it sounds like the problem is in the controller method code. What does it do?
Please check page codebehind tag in ASPX page. May it has DetermineBandResult view model in that.
Avatar of ToString1
ToString1

ASKER

ok thanks.

So really what we are saying is that there needs to be a view called "DetermineBandResult" for this to work
Hi,

when TeamAdminController is placed in another area, i think you need to add the name of that area to the route-values.

Html.BeginForm("action", "controller", new {area="areaname", id=User.Id} ...
Yes that is correct.  However I am strill grasping with the concept of

Html.BeginForm("myAction", "controller"}

Does the view "myAction" have to exist?   Can it be an actionresult without a view?
ASKER CERTIFIED SOLUTION
Avatar of Craig Wagner
Craig Wagner
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial