public override void SyncChanges() { // Make sure that all is set up EnsureChildControls(); // Update the editor VisualGrid webPart = (VisualGrid)WebPartToEdit; if (webPart != null) { Count.Text = webPart.Count.ToString(); RowCount.Text = webPart.RowCount.ToString(); if ((!String.IsNullOrEmpty(webPart.AlbumInfo)) && (Channels.Items.FindByValue(webPart.AlbumInfo) != null)) { Channels.SelectedValue = webPart.AlbumInfo; } else { Channels.SelectedValue = "-"; } if (webPart.Tags != null) { foreach (string tag in webPart.Tags) { ListItem listItem = Tags.Items.FindByValue(tag); if (listItem != null) { listItem.Selected = true; } } } Order.SelectedValue = webPart.Order; TagMode.SelectedValue = (webPart.TagMode == "All" ? "All" : "Any"); Sizes.SelectedValue = webPart.Size.ToString(); ClickPlayCheck.Checked = webPart.ClickToPlay; TokenFreeCheck.Checked = webPart.TokenFreeEmbeds; } return; }
public override bool ApplyChanges() { // Make sure that all is set up EnsureChildControls(); // Update the web part VisualGrid webPart = (VisualGrid)WebPartToEdit; if (webPart != null) { // Counts webPart.Count = Convert.ToInt32(Count.Text); webPart.RowCount = Convert.ToInt32(RowCount.Text); // Album webPart.AlbumInfo = ((String.IsNullOrEmpty(Channels.SelectedValue)) || (Channels.SelectedValue == "-") ? null : Channels.SelectedValue); // Tags List <string> tags = new List <string>(); foreach (ListItem tag in Tags.Items) { if (tag.Selected) { tags.Add(tag.Value); } } webPart.Tags = tags; webPart.TagMode = TagMode.SelectedValue; webPart.Order = Order.SelectedValue; webPart.Size = (VideoSize)Enum.Parse(typeof(VideoSize), Sizes.SelectedValue); webPart.ClickToPlay = ClickPlayCheck.Checked; webPart.TokenFreeEmbeds = TokenFreeCheck.Checked; } return(true); }