protected void previewButton_OnClick(object sender, EventArgs e) { countLabel.Font.Bold = false; string prefixContent = prefixText.Text; if (!string.IsNullOrEmpty(prefixText.Text)) { Session["finalPrefix"] = prefixContent; } if (!string.IsNullOrEmpty(pageRequestText.Text)) { var PreviewPaneItemsSessionList = Session["PreviewPaneItems"] as List <string>; // Create new, if null if (PreviewPaneItemsSessionList == null) { PreviewPaneItemsSessionList = new List <string>(); } requestLabel.Text = ""; try { if (submitJobButton.Visible == false) { submitJobButton.Visible = true; } if (previewPane.Items.Count > 0) { previewPane.Items.Clear(); } countLabel.Text = ""; countLabel.Visible = false; var requestText = pageRequestText.Text; parsedRequestText = requestText.Split(';'); foreach (var pageRequest in parsedRequestText) { // Foreach parsed value, preview the request objects foreach (string PageTitle in wHelper.previewRequest(pageRequest)) { if (!PageTitle.Contains("Category:") && !PageTitle.Contains("Template:")) { previewPane.Items.Add(PageTitle); PreviewPaneItemsSessionList.Add(PageTitle); } } } Session["PreviewPaneItems"] = PreviewPaneItemsSessionList; if (previewPane.Visible != true && countLabel.Visible != true) { previewPane.Visible = true; previewPane.Height = 250; countLabel.Text = "Total count of Articles: " + previewPane.Items.Count.ToString(); countLabel.Visible = true; totalCount = previewPane.Items.Count; } else { countLabel.Text = "Total count of Articles: " + previewPane.Items.Count.ToString(); countLabel.Visible = true; totalCount = previewPane.Items.Count; } } catch (Exception exception) { requestLabel.Text = exception.ToString() + " \r\n\r\n" + ServicePointManager.SecurityProtocol.ToString() + " \r\n\r\n " + urlTest; } } else { submitJobButton.Visible = false; previewPane.Visible = false; countLabel.Font.Bold = true; countLabel.Text = "Please enter a valid search term!"; } }