/// <summary> /// Handles export button click. /// </summary> /// <param name="sender">Sender</param> /// <param name="e">Event arguments</param> protected void btnExport_Click(object sender, EventArgs e) { // Check "manage subscribers" permission if (!CMSContext.CurrentUser.IsAuthorizedPerResource("cms.newsletter", "managesubscribers")) { RedirectToCMSDeskAccessDenied("cms.newsletter", "managesubscribers"); } // Get selected newsletters List <int> newsletterIds = new List <int>(); string values = ValidationHelper.GetString(usNewsletters.Value, null); if (!String.IsNullOrEmpty(values)) { string[] newItems = values.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); if (newItems != null) { foreach (string item in newItems) { newsletterIds.Add(ValidationHelper.GetInteger(item, 0)); } } } // Export subscribers string subscribers = null; if (CMSContext.CurrentSite != null) { subscribers = SubscriberInfoProvider.ExportSubscribersFromSite(newsletterIds, CMSContext.CurrentSiteID, true, ValidationHelper.GetInteger(rblExportList.SelectedValue, 0)); } // No subscribers exported if (string.IsNullOrEmpty(subscribers)) { ShowInformation(GetString("Subscriber_Export.noSubscribersExported")); txtExportSub.Enabled = false; } else { ShowInformation(GetString("Subscriber_Export.subscribersExported")); txtExportSub.Enabled = true; } txtExportSub.Text = subscribers; }