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

[Solved] Items not showing (using areas)

3 Answers 52 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.
Marko Gluhak
Top achievements
Rank 1
Marko Gluhak asked on 07 Feb 2012, 03:30 PM

 

Hi,

I'm not sure is this a bug or normal behaviour. I have MVC project with 2 areas. I called Administration and second called Client.

I have put menu control inside Administration area inside _Layout.cshtml (Areas\Administration\Views\Shared\).

Control is used like this:

            @(Html.Telerik( ).Menu( )
                    .Name( "menu" )
                    .Items( menu =>
                    {
                        menu.Add( ).Text( "Users" ).Action( "Index", "Users" );
                        menu.Add( ).Text( "Booking" ).Action( "Index", "Booking" );
                        menu.Add( ).Text( "Boats" ).Action( "Index", "Boats" );
                        menu.Add( ).Text( "Contents" ).Action( "Index", "Contents" );
                        menu.Add( ).Text( "FAQ" ).Action( "Index", "FAQ" );
                        menu.Add( ).Text( "Settings" ).Action( "Index", "Settings" );
                        menu.Add( ).Text( "Translations" ).Action( "Index", "Translations" );
                        menu.Add( ).Text( "Logoff" ).Url( "/en/Authentication/LogOff" );
                    } ))

All items were shown except "Booking" (second one").

After some time I found out that reason was because I have same named controller in "Client" area and it was not showing because controller in that are need to have users of role Client which was not the case.

So problem was that Menu control was getting link of controller in another area insted of one that if was places in.

To solve this use parameter:
menu.Add( ).Text( "Booking" ).Action( "Index", "Booking", new { area = "Administration" } );

My opinion that this is bug because menu should take controller Booking from Administration area and not Client.

3 Answers, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 09 Feb 2012, 11:16 AM
Hello Marko,

 
The described behavior is expected. If you have two or more Controller with the same name, you will need to specify the area name. Thus the menu will get the right one.

Regards,
Georgi Krustev
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Marko Gluhak
Top achievements
Rank 1
answered on 09 Feb 2012, 11:24 AM
Thank you for reply.

I would expect that control will recognize that it is inside "Administration" area and so that it would firstly look for controller inside that area if area is not explicitely entered  in declaration.

If that is possible it would be more logical than it is now.

Marko
0
Accepted
Georgi Krustev
Telerik team
answered on 09 Feb 2012, 11:28 AM
Hello Marko,

 
I will log your request ot our internal system for further investigation. If other users want such functionality we will schedule it for further investigation.

All the best,
Georgi Krustev
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
Menu
Asked by
Marko Gluhak
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Marko Gluhak
Top achievements
Rank 1
Share this question
or