This is a migrated thread and some comments may be shown as answers.
Telerik Menu + partialview controller not invoked.
1 Answer 25 Views
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Naunihal
Top achievements
Rank 1
Naunihal asked on 06 Sep 2011, 08:03 PM
I am getting object not set to an instance error, as this is created as partial view.

in the _Layout.cshtml i have added the   
<div id=Menu>
              @Html.Partial("_Menu")
</div>

the controller is never invoked, how can i specify that a specific controller be used in the partial view _Menu.cshtml
here the _Menu.cshtml partial view

@using eGate.BackOffice.WebClient.Models
@model IEnumerable<Accounts.MainMenu>

@{
    ViewBag.Title = "Menu";
}

<h2>Menu</h2>

   
       @(Html.Telerik().Menu()        
            .Name("Menu")
            .BindTo(Model, mappings =>         
            {            
                mappings.For<Accounts.MainMenu>(binding => binding                    
                    .ItemDataBound((item, mainMenu) =>                    
                    {
                        item.Text = mainMenu.MenuName;                    
                    })
                    .Children(mainMenu => mainMenu.ChildMenus));            
                mappings.For<Accounts.ChildMenu>(binding => binding                    
                    .ItemDataBound((item, childMenu) =>                    
                    {
                        item.Text = childMenu.MenuName;                    
                    }));        
            })
        )

1 Answer, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 07 Sep 2011, 11:00 AM
Hello Naunihal,

Such behavior is expected and the problem is not related to Telerik. For such purpose you should use RenderAction - more information on this method is available in the MSDN.


Kind regards,
Georgi Tunev
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Tags
Menu
Asked by
Naunihal
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
Share this question
or