protected void Treeview_Click() { Item selectionItem = Treeview.GetSelectionItem(); if (selectionItem != null) { SelectedItemId = string.Empty; ItemCollection children = DataContext.GetChildren(selectionItem); Renderings.InnerHtml = children == null || children.Count <= 0 ? RenderEmptyPreview(selectionItem) : RenderPreviews(children); } SetOpenPropertiesState(selectionItem); }
/// <summary> /// Handles a click on the OK button. /// </summary> /// <param name="sender"/><param name="args"/> /// <remarks> /// When the user clicks OK, the dialog is closed by calling /// the <see cref="M:Sitecore.Web.UI.Sheer.ClientResponse.CloseWindow">CloseWindow</see> method. /// </remarks> /// <contract><requires name="sender" condition="not null"/><requires name="args" condition="not null"/></contract> protected override void OnOK(object sender, EventArgs args) { Assert.ArgumentNotNull(sender, "sender"); Assert.ArgumentNotNull((object)args, "args"); if (!string.IsNullOrEmpty(SelectedItemId)) { SetDialogResult(ShortID.Parse(SelectedItemId).ToID().ToString()); } else { Item selectionItem = Treeview.GetSelectionItem(); if (selectionItem != null && IsItemRendering(selectionItem)) { SetDialogResult(selectionItem.ID.ToString()); } else { SheerResponse.Alert("Please select a rendering item", new string[0]); } } }