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

Action gets assigned to Parent node when Area is set

3 Answers 46 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Veeralakshmi
Top achievements
Rank 1
Veeralakshmi asked on 13 Apr 2015, 08:10 AM

Hi

I have created Kendo menu using Model binding and set the Area as shown below

 

@(Html.Kendo().Menu()
.Name("menu")
.BindTo(Model,mp=>
{
mp.For<MyModel>(binding => binding 
            .ItemDataBound((item, main) =>             {
item.Text = main.FormName;
if (main.ActionName != "")
{
item.Action(main.ActionName, main.ControllerName, new { area = main.AreaName });
// item.ActionName = main.ActionName;
// item.ControllerName = main.ControllerName;
}
})
.Children(main => main.Children));
})
    
   )

 

Menus are loaded correctly with 2 levels and the actions are invoked from respective areas correctly. However for the parent node default action is set. Parent node is not assigned any action.

 

When Area is removed, the parent node does not have action. When setting area, parent node also gets Href

 Warm Regards,

Veeralakshmi Jeyavelu

 

 

3 Answers, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 15 Apr 2015, 08:19 AM
Hello Veeralakshmi,

The only option for the parent node to have a default Action is if its ControllerName/ActionName is set. Here is a screencast that shows when the parent node renders a href attribute.

I would suggest you verify that the parent's ActionName indeed is not set. If the problem still persists, please send us a repro demo.

Regards,
Georgi Krustev
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
0
Veeralakshmi
Top achievements
Rank 1
answered on 20 Apr 2015, 12:34 PM

Hi, Thanks for your reply.

I checked  you screen cast. I get this problem when binding using asp.net MVC model. As shown in the code snippet

item.Text = main.FormName;
if (main.ActionName != "")
{
item.Action(main.ActionName, main.ControllerName, new { area = main.AreaName });

}

 

For nodes that do not have action in model - only text is assigned. However when using area

internally sets area as "" and adds href

When in the same code snippet area is not given, works fine

Can you please check the problem of binding using a model?

 

Thanks again

Warm Regards,

Veeralakshmi Jeyavelu

 

 

0
Georgi Krustev
Telerik team
answered on 22 Apr 2015, 09:18 AM
Hello again Veeralakshmi,

I modified the test demo to use model binding, but I still cannot observe the erroneous behavior. I attached the demo to this message. Would it be possible to modify it in order to replicate the issue?

Regards,
Georgi Krustev
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

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