Panel bar custom helper : how to add item

2 posts, 0 answers
  1. Antoine
    Antoine avatar
    3 posts
    Member since:
    Oct 2014

    Posted 03 Dec 2014 Link to this post


    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
  2. Petur Subev
    Petur Subev avatar
    1882 posts

    Posted 05 Dec 2014 Link to this post

    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.

  3. UI for ASP.NET AJAX banner
Back to Top