public void BindGrid() { string sDataSource = string.Empty; if (Request.Cookies["Company"] != null) { sDataSource = System.Configuration.ConfigurationManager.ConnectionStrings[Request.Cookies["Company"].Value].ToString(); } else { Response.Redirect("~/Login.aspx"); } DataSet ds = new DataSet(); BusinessLogic bl = new BusinessLogic(sDataSource); ds = bl.ListComplaints(sDataSource, txtSearch.Text, ddCriteria.SelectedValue, chkActive.Checked); if (ds != null) { GrdViewComplaint.DataSource = ds.Tables[0].DefaultView; GrdViewComplaint.DataBind(); } else { GrdViewComplaint.DataSource = null; GrdViewComplaint.DataBind(); } }
protected void cmdSearch_Click(object sender, EventArgs e) { try { string sDataSource = string.Empty; if (Request.Cookies["Company"] != null) { sDataSource = System.Configuration.ConfigurationManager.ConnectionStrings[Request.Cookies["Company"].Value].ToString(); } else { Response.Redirect("~/frm_Login.aspx"); } DataSet ds = new DataSet(); BusinessLogic bl = new BusinessLogic(sDataSource); ds = bl.ListComplaints(sDataSource, txtSearch.Text, ddCriteria.SelectedValue, chkActive.Checked); if (ds != null) { GrdViewComplaint.DataSource = ds.Tables[0].DefaultView; GrdViewComplaint.DataBind(); } else { GrdViewComplaint.EmptyDataText = "No Complaints found"; GrdViewComplaint.DataSource = null; GrdViewComplaint.DataBind(); } } catch (Exception ex) { TroyLiteExceptionManager.HandleException(ex); } }