/// <summary> /// Handles the Click event of the btnDelete control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected void btnDelete_Click(object sender, EventArgs e) { CurrentUiTemplate = GetSelectedJQueryTemplate(); string invalidReason; if (ValidateUiTemplateBeforeDelete(out invalidReason)) { CurrentUiTemplate.Delete(); BindTemplateNameDropDownList(); CurrentUiTemplate = GetSelectedJQueryTemplate(); BindUiTemplate(); ViewMode = PageMode.Edit; ClientMessage = new ClientMessageOptions { Title = Resources.GalleryServer.Admin_Save_Success_Hdr, Message = Resources.GalleryServer.Admin_Templates_Deleted_Msg, Style = MessageStyle.Success }; } else { ClientMessage = new ClientMessageOptions { Title = Resources.GalleryServer.Validation_Summary_Text, Message = invalidReason, Style = MessageStyle.Error }; } }
protected void btnSave_Click(object sender, EventArgs e) { CurrentUiTemplate = GetSelectedJQueryTemplate(); string invalidReason; if (ValidateUiTemplateBeforeSave(out invalidReason)) { UnbindJQueryTemplate(); CurrentUiTemplate.Save(); BindTemplateNameDropDownList(); ddlTemplateName.SelectedIndex = ddlTemplateName.Items.IndexOf(ddlTemplateName.Items.FindByValue(CurrentUiTemplate.UiTemplateId.ToString(CultureInfo.InvariantCulture))); ViewMode = PageMode.Edit; ClientMessage = new ClientMessageOptions { Title = Resources.GalleryServerPro.Admin_Save_Success_Hdr, Message = Resources.GalleryServerPro.Admin_Save_Success_Text, Style = MessageStyle.Success }; } else { ClientMessage = new ClientMessageOptions { Title = Resources.GalleryServerPro.Validation_Summary_Text, Message = invalidReason, Style = MessageStyle.Error }; } }
/// <summary> /// Handles the Click event of the lbCreate control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected void lbCreate_Click(object sender, EventArgs e) { ViewMode = PageMode.Insert; IUiTemplate tmplCopy = CurrentUiTemplate.Copy(); tmplCopy.Name = GenerateUniqueTemplateName(); CurrentUiTemplate = tmplCopy; ddlTemplateName.Items.Add(new ListItem(tmplCopy.Name, int.MinValue.ToString())); ddlTemplateName.SelectedIndex = ddlTemplateName.Items.Count - 1; btnDelete.Enabled = false; BindUiTemplate(); }