?
Solved

MVC3: Having trouble routing to a page in a different area

Posted on 2012-03-10
5
Medium Priority
?
322 Views
Last Modified: 2012-03-12
I am using
:

@Html.ActionLink("TestPage in other area", "Index", "ExternalSystem", "~/Areas/ExternalSystem/");

BUT I think the fourth parameter is not correct.

What should that value be? I am trying to route to a page locater in an Area different than the Area where the page is located where the button is located.

Thanks.
0
Comment
Question by:newbieweb
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 14

Accepted Solution

by:
binaryevo earned 2000 total points
ID: 37708113
So just to be clear, you having more than 1 area in your application and you are trying to get to that other area, is this right?  If so, I believe the correct syntax looks something like this:

@Html.ActionLink("test", "Index", "TestArea", new { area="Test1"}, new {}) 

Open in new window

0
 

Author Comment

by:newbieweb
ID: 37708126
Yes, you are right. I already got that working before your post, but I need to post a model and have as yet been unsuccessful. So when I set a breakpoint in the Controller Action of the target Controller, I see the program execution stops there. So I know the fourth parameter is right. But the model is being re-created rather than submitted from the page.

There is a model being passed in which is valid. But none of the values have been set.  But the model in he View have the values set, since I can see them displayed on the page. How do I get the model from the View posted to the Controller Action which is successfully receiving control and which clearly has the correct input parameter type?
0
 
LVL 14

Expert Comment

by:binaryevo
ID: 37708131
I need to see more code
0
 

Author Comment

by:newbieweb
ID: 37708258
Ok, the link on page #1 looks like this:

@Html.ActionLink("text", "MyAction", "Controller2", new { area="Area2"}, null)

The Model for Page 1 and Page 2 are:
@model Web.Areas.Area1.Models.UserModel

[HttpPost]
public ActionResult MyAction(UserModel model)
{
    // the breakpoint here is hit, so control is passing  correctly to Controller2 in Area2

But the value contained in model are null, as when you just new'ed a UserModel. But, the page which is posting has real values in its model, when it posts to its own controller action.

Ideas?
0
 

Author Closing Comment

by:newbieweb
ID: 37710765
Thanks!
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Suggested Courses

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question