protected override void OnLoad(System.EventArgs e) { base.OnLoad(e); if (!XamlControl.AjaxScriptManager.IsEvent) { UrlHandle handle = UrlHandle.Get(); string notFoundTag = handle["tagNotFound"]; if (!string.IsNullOrEmpty(notFoundTag)) { messageLiteral.Text = string.Format("Sitecore couldn't recognize the '<b>{0}</b>' tag.<br/>", notFoundTag) + messageLiteral.Text; categoryNameEdit.Text = notFoundTag; } string categoriesRootId = handle["categoriesRootId"]; //Item rootItem = Client.ContentDatabase.GetItem(new ID(categoriesRootId)); Database db = Sitecore.Context.ContentDatabase ?? Sitecore.Context.Database; Item rootItem = db.GetItem(new ID(categoriesRootId)); TreeviewSource treeviewSource = new TreeviewSource(); categoryTreeview.Nodes.Clear(); treeviewSource.Render(categoryTreeview, rootItem, true); categoryTreeview.ClientEvents.NodeSelect = new ClientEvent("categoryTreeview_OnNodeSelect"); } }