This is a migrated thread and some comments may be shown as answers.

Areas & ambiguous controller name in Menu

3 Answers 64 Views
Menu
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
dejavu
Top achievements
Rank 2
dejavu asked on 06 Jul 2010, 02:25 AM
Hi,

i have a simple menu inside an asp.net mvc 2 project, using Telerik's MVC menu. Inside that project are three areas, each one with the same structure, so, ListController, AddController and ModifyController are the controller's name on each one of them.

Menu items are built using the constructor that takes three params:

 

item.Add().Text("List").Action("Index""List"new { area = "Area1" }) 

and so with the other two:

item.Add().Text("Add").Action("Index""Add"new { area = "Area2" })  
item.Add().Text("Modify").Action("Index""Modify"new { area = "Area3" }) 

Problem is the known "Ambiguous controller name" gotcha. But using this Action constructor does nothing to solve it. Hope it can be done with current version Telerik MVC extensions. Anyway, amazing product i must say.

Thanks in advance.

3 Answers, 1 is accepted

Sort by
0
Derek Hunziker
Top achievements
Rank 1
answered on 08 Jul 2010, 12:14 AM
Hey there,

I had a similar issue and was able to get it working by passing in a namespace for my area registrations like so:

public override void RegisterArea(AreaRegistrationContext context) 
    context.MapRoute( 
        "MyArea_default"
        "MyArea/{controller}/{action}/{id}"
        new { action = "Index", id = UrlParameter.Optional }, 
        new string[] { "MyApp.Areas.MyArea.Controllers" } 
    ); 

0
dejavu
Top achievements
Rank 2
answered on 09 Jul 2010, 02:52 AM
Hi there,

do you have two or more controlers with the same name in different areas? this is my case, and whit that area structure i've not been able to solve it yet.

Regars,

dejavu
0
Accepted
Georgi Krustev
Telerik team
answered on 09 Jul 2010, 08:27 AM
Hello dejavu,

I have attached a simple test project. which implements the required functionality. In it menu can navigate to same controller and action in different areas.

Greetings,
Georgi Krustev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Menu
Asked by
dejavu
Top achievements
Rank 2
Answers by
Derek Hunziker
Top achievements
Rank 1
dejavu
Top achievements
Rank 2
Georgi Krustev
Telerik team
Share this question
or