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

Panel bar custom helper : how to add item

1 Answer 131 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Antoine asked on 03 Dec 2014, 08:38 AM

I need to make my own helper of panel bar to manage conditional displaying of items.

I made it like this

public static Kendo.Mvc.UI.Fluent.PanelBarBuilder MovementPanel(this HtmlHelper helper, string name, Boolean withContainer,string Controller, RouteValueDictionary export)
    Kendo.Mvc.UI.Fluent.PanelBarBuilder myPanel = helper.Kendo().PanelBar()
     PanelBarItem itAction = new PanelBarItem();
     itAction.Text = "Actions";
     itAction.Items.Add(NewBarItem("Error detail","javascript:void(0)"));
     itAction.Items.Add(NewBarItem("File content", "javascript:void(0)"));
     PanelBarItem itExcel = new PanelBarItem();
     itExcel.Text = "Excel export";
     itExcel.Action("ExportToExcel", Controller, export);
    if (withContainer)
        itAction.Items.Add(NewBarItem("Container history", "javascript:void(0)"));
    myPanel.ItemAction(ac => ac.Items.Add(itAction));
    myPanel.Events(events =>
    return myPanel;
private static PanelBarItem NewBarItem(string text, string url)
    PanelBarItem itTemp = new PanelBarItem();
    itTemp.Text = text;
    itTemp.Url = url;
    return itTemp;

But how can I link items to the PanelBarBuilder ?

With this instructions : myPanel.ItemAction(ac => ac.Items.Add(itAction));

Method only returns javascript.

thanks for your help

1 Answer, 1 is accepted

Sort by
Petur Subev
Telerik team
answered on 05 Dec 2014, 10:01 AM
Hello Antoine,

ItemAction is a function that will be executed for each of the items, it is not a JavaScript function, it is a C# function.

myPanel.ItemAction(x=> {});

Could you please clarify what exactly is the issue that you struggle with, could you please explain a scenario?

Petur Subev

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Asked by
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Share this question