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?
ToString1Asked:
Who is Participating?
 
Craig WagnerConnect With a Mentor Software ArchitectCommented:
Your form is not submitting to a View, it is submitting to a controller action (i.e. TeamAdminController.DetermineBandResult). The controller action is probably then turning around and doing a "return View()". If that is the case, then it is expecting a view under Views/TeamAdmin/DetermineBandResult.aspx. This is why I asked initially to see the controller method.

Alternatively, you can return any view you want by specifying the view name, for example:

return View("SomeOtherView")

Another alternative is to return an ActionResult that isn't a view, for example:

return Redirect("SomeOtherPage.aspx")

Or redirect to a different action, for example:

return RedirectToAction("MyOtherAction")
0
 
Craig WagnerSoftware ArchitectCommented:
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?
0
 
Alpesh PatelAssistant ConsultantCommented:
Please check page codebehind tag in ASPX page. May it has DetermineBandResult view model in that.
0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

 
ToString1Author Commented:
ok thanks.

So really what we are saying is that there needs to be a view called "DetermineBandResult" for this to work
0
 
dr_PitterCommented:
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} ...
0
 
ToString1Author Commented:
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?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.