3

This ActionLink works fine when it is outside of an area, but as soon as I moved it into one it started appending the name of the controller to the url:TrainingandDevelopment/MakeCall

It should just be displaying the paritial view that it is calling.

Ajax.ActionLink("Click to Get HRMS Folder", "MakeCall", new { folderName = "HRMS" }, new AjaxOptions()
                                                    {
                                                        UpdateTargetId = "placeHolder",
                                                        InsertionMode = InsertionMode.Replace,
                                                        LoadingElementId = "indicator",
                                                        HttpMethod = "POST",
                                                    })

2 Answers 2

1

Add a blank area to your route values

Ajax.ActionLink("Click to Get HRMS Folder", 
                "MakeCall", 
                new { folderName = "HRMS", area= ""}, 
                new AjaxOptions() {
                                      UpdateTargetId = "placeHolder",
                                      InsertionMode = InsertionMode.Replace,
                                      LoadingElementId = "indicator",
                                      HttpMethod = "POST",
                                  })
2
  • This still added the name of the action to the URL, but the extra TrainingandDevelopment was removed. Any ideas on how to fix it? Jan 19, 2012 at 14:28
  • I though the TrainingAndDevelopment part was the issue. If you remove the action from the Url how will the link know where to go?
    – NinjaNye
    Jan 19, 2012 at 15:45
0

MSDN - When you create an ASP.NET MVC application that includes areas, you must define routes that send requests to the appropriate area based on the request URL. To register a route that can respond to area-specific requests, you add a Routes class to the area. Your Routes class inherits from the AreaRegistration class. You can name an area by overriding the AreaName property and set up routes for the area by overriding the RegisterArea method.

So, you have to add the routes.cs file to your area folder.

More Information

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.