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
};
toolbaritems.Add(item);
ToolBarItemFactory factory = new ToolBarItemFactory(toolbaritems);
ViewData["DocumentToolbar"] = factory;
I have then tried to bind the data to the control as follows.
@(Html.Kendo().ToolBar()
.Name("ToolBar")
.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?