Binding a Toolbar to data

2 posts, 0 answers
  1. Dominic
    Dominic avatar
    4 posts
    Member since:
    Jul 2016

    Posted 10 May 2018 Link to this post

    Is there a way of binding a Toolbar to data in the same way as the Treeview can be bound to data?

    I have tried creating my toolbar list dynamically as follows.

    List<ToolBarItem> toolbaritems = new List<ToolBarItem>();
    ToolBarItem item = new ToolBarItem
        Text = "Button",
        Type = CommandType.Button
    ToolBarItemFactory factory = new ToolBarItemFactory(toolbaritems);
    ViewData["DocumentToolbar"] = factory;

    I have then tried to bind the data to the control as follows.

        .Items((Action<ToolBarItemFactory>) ViewData["DocumentToolbar"]))

    I am getting the following error.

    InvalidCastException: Unable to cast object of type 'Kendo.Mvc.UI.Fluent.ToolBarItemFactory' to type 'System.Action`1[Kendo.Mvc.UI.Fluent.ToolBarItemFactory]'.

    Is this possible? And if so, how?

  2. Ianko
    Ianko avatar
    1914 posts

    Posted 15 May 2018 Link to this post

    Hello Dominic,

    The facility you are refering to is the BindTo mechanism ( Such is not available for the ToolBar. However, you can add a loop in the Items() method as action, traverse the object from the ViewData and bind it using the ToolBarItemFactory's methods. Similar to this demo here (, but using the Toolbar instead. 

    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top