/// <summary> /// Initializes the control properties. /// </summary> protected void SetupControl() { if (this.StopProcessing) { } else { lblFirstName.Text = this.FirstNameText; lblLastName.Text = this.LastNameText; lblEmail.Text = this.EmailText; lblCaptcha.ResourceString = this.CaptchaText; plcCaptcha.Visible = this.DisplayCaptcha; if ((this.UseImageButton) && (!String.IsNullOrEmpty(this.ImageButtonURL))) { pnlButtonSubmit.Visible = false; pnlImageSubmit.Visible = true; btnImageSubmit.ImageUrl = this.ImageButtonURL; } else { pnlButtonSubmit.Visible = true; pnlImageSubmit.Visible = false; btnSubmit.Text = this.ButtonText; } // Display labels only if user is logged in and property AllowUserSubscribers is set to true if (AllowUserSubscribers && CMSContext.CurrentUser.IsAuthenticated()) { visibleFirstName = false; visibleLastName = false; visibleEmail = false; } // Otherwise display text-boxes else { visibleFirstName = true; visibleLastName = true; visibleEmail = true; } // Hide first name field if not required if (!this.DisplayFirstName) { visibleFirstName = false; } // Hide last name field if not required if (!this.DisplayLastName) { visibleLastName = false; } if (this.NewsletterName.Equals("nwsletuserchoose", StringComparison.InvariantCultureIgnoreCase)) { chooseMode = true; plcNwsList.Visible = true; if ((!ExternalUse || !RequestHelper.IsPostBack()) && (chklNewsletters.Items.Count == 0)) { DataSet ds = null; // Try to get data from cache using (CachedSection <DataSet> cs = new CachedSection <DataSet>(ref ds, this.CacheMinutes, true, this.CacheItemName, "newslettersubscription", CMSContext.CurrentSiteName)) { if (cs.LoadData) { // Get the data ds = NewsletterProvider.GetAllNewslettersForSite(CMSContext.CurrentSiteID, "NewsletterDisplayName", 0, "NewsletterDisplayName,NewsletterName"); // Add data to the cache if (cs.Cached) { cs.CacheDependency = GetCacheDependency(); cs.Data = ds; } } } if (!DataHelper.DataSourceIsEmpty(ds)) { ListItem li = null; // Fill checkbox list with newsletters foreach (DataRow dr in ds.Tables[0].Rows) { li = new ListItem(HTMLHelper.HTMLEncode(ValidationHelper.GetString(dr["NewsletterDisplayName"], string.Empty)), ValidationHelper.GetString(dr["NewsletterName"], string.Empty)); chklNewsletters.Items.Add(li); } } } } else { // Hide newsletter list plcNwsList.Visible = false; } // Set SkinID properties if (!this.StandAlone && (this.PageCycle < PageCycleEnum.Initialized) && (string.IsNullOrEmpty(ValidationHelper.GetString(this.Page.StyleSheetTheme, string.Empty)))) { string skinId = this.SkinID; if (!string.IsNullOrEmpty(skinId)) { lblFirstName.SkinID = skinId; lblLastName.SkinID = skinId; lblEmail.SkinID = skinId; txtFirstName.SkinID = skinId; txtLastName.SkinID = skinId; txtEmail.SkinID = skinId; btnSubmit.SkinID = skinId; } } } }