protected void btnCampaignSearch_Click(object sender, EventArgs e) { try { lblCampaignSearch.Text = ""; List <Campaign> campaignsList = SharePointConnector.GetCampaigns(txbCampaign.Text.Trim()); //System.Threading.Thread.Sleep(1000); if (campaignsList.Count == 0) { lblCampaignSearch.Text = "No existen nombres de campañas que contengan los caracteres ingresados.<br/>Puede que la campaña buscada ya no esté vigente."; } else { lsbCampaign.Enabled = true; } lsbCampaign.DataSource = campaignsList; lsbCampaign.DataTextField = "CampaignName"; lsbCampaign.DataValueField = "CampaignImage"; lsbCampaign.DataBind(); txbCampaign.Focus(); } catch (Exception ex) { System.Web.UI.LiteralControl errorMessage = new System.Web.UI.LiteralControl(); errorMessage.Text = ex.Message; this.Controls.Clear(); this.Controls.Add(errorMessage); } }