public void BindMakerGrid() { BLL_Infra_SupplierList objSupp = new BLL_Infra_SupplierList(); int rowcount = ucCustomPagerItems.isCountRecord; string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString()); int? sortdirection = null; if (ViewState["SORTDIRECTION"] != null) { sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString()); } DataTable dt = objSupp.Get_Suppliers_List_Search(txtfilter.Text != "" ? txtfilter.Text : null, sortbycoloumn, sortdirection, ucCustomPagerItems.CurrentPageIndex, ucCustomPagerItems.PageSize, ref rowcount); if (ucCustomPagerItems.isCountRecord == 1) { ucCustomPagerItems.CountTotalRec = rowcount.ToString(); ucCustomPagerItems.BuildPager(); } if (dt.Rows.Count > 0) { gvSuppliers.DataSource = dt; gvSuppliers.DataBind(); } else { gvSuppliers.DataSource = dt; gvSuppliers.DataBind(); } }
protected void ImgExpExcel_Click(object sender, EventArgs e) { //BLL_Infra_Supplier objSupp = new BLL_Infra_Supplier(); BLL_Infra_SupplierList objSupp = new BLL_Infra_SupplierList(); int rowcount = ucCustomPagerItems.isCountRecord; string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString()); int? sortdirection = null; if (ViewState["SORTDIRECTION"] != null) { sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString()); } //DataTable dt = objSupp.Get_Suppliers_List_Search(txtfilter.Text != "" ? txtfilter.Text : null, sortbycoloumn, sortdirection, ucCustomPagerItems.CurrentPageIndex, ucCustomPagerItems.PageSize, ref rowcount); DataTable dt = objSupp.Get_Suppliers_List_Search(txtfilter.Text != "" ? txtfilter.Text : null, sortbycoloumn, sortdirection, null, null, ref rowcount); string[] HeaderCaptions = { "Code", "Name", "Currency", "Country", "Email", "Address", "Phone", "Fax", "Telex" }; string[] DataColumnsName = { "Supplier_Code", "Supplier_Name", "Supplier_Currency", "Country", "Email", "Address_1", "Phone", "fax", "TELEX" }; GridViewExportUtil.ShowExcel(dt, HeaderCaptions, DataColumnsName, "Supplier", "Supplier", ""); }