protected void btnAgreementSearch_Click(object sender, EventArgs e) { try { lblAgreementSearch.Text = ""; List <Agreement> agreementsList = SharePointConnector.GetAgreements(txbAgreement.Text.Trim()); //System.Threading.Thread.Sleep(1000); if (agreementsList.Count == 0) { lblAgreementSearch.Text = "No existen nombres de convenios que contengan los caracteres ingresados."; } else { lsbAgreement.Enabled = true; } lsbAgreement.DataSource = agreementsList; lsbAgreement.DataTextField = "AgreementName"; lsbAgreement.DataValueField = "AgreementImage"; lsbAgreement.DataBind(); txbAgreement.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); } }