public void BindLocation() { int rowcount = 1; string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString()); int? sortdirection = null; if (ViewState["SORTDIRECTION"] != null) { sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString()); } DataTable dt = BLL_PURC_ItemLocation.GetLocation_Search(UDFLib.ConvertIntegerToNull(ddlPLocation.SelectedValue), txtSearchBy.Text, sortbycoloumn, sortdirection, ucCustomPagerItems.CurrentPageIndex, ucCustomPagerItems.PageSize, ref rowcount); gvLocation.DataSource = dt; gvLocation.DataBind(); ucCustomPagerItems.CountTotalRec = rowcount.ToString(); ucCustomPagerItems.BuildPager(); }
protected void btnExport_Click(object sender, ImageClickEventArgs e) { 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 = BLL_PURC_ItemLocation.GetLocation_Search(UDFLib.ConvertIntegerToNull(ddlPLocation.SelectedValue), txtSearchBy.Text, sortbycoloumn, sortdirection, null, null, ref rowcount); string[] HeaderCaptions = { "Parent Name", "Location Name" }; string[] DataColumnsName = { "Parent_Name", "Location_Name" }; GridViewExportUtil.ShowExcel(dt, HeaderCaptions, DataColumnsName, "Item Location", "Item Location"); }