Howdy,
I am trying to create my TreeView's context menu after the TreeView has been bound and do so on the server. I am running into an issue however. The code below results in an empty Items collection on the contextMenu object. If I break in the code, after the DataBind(), I can see that the DataSource on the contextMenu has a collection of objects, but nothing is in the Items collection. Therefor, there is no context menu once the page renders.
| protected void tabTreeView_OnDataBound(object sender, EventArgs e) |
| { |
| RadTreeViewContextMenu contextMenu = new RadTreeViewContextMenu(); |
| contextMenu.DataFieldID = "MenuItemId"; |
| contextMenu.DataFieldParentID = "ParentId"; |
| contextMenu.DataTextField = "DisplayText"; |
| contextMenu.DataValueField = "DisplayText"; |
| contextMenu.DataSource = this.GetUnusedMenuItems(); |
| contextMenu.DataBind(); |
| tabTreeView.ContextMenus.Add(contextMenu); |
| } |
Why is the Items collection not being populated when I call DataBind? I can load the items in manually with a foreach loop (tested it and it works fine), but I didn't want to have to figure out the underlying hierarchy (the menu items I am using can be nested).
Thanks for any help,
Seth