protected void InitialCountryBind() { int rowcount = 1; DataTable dt = BLL_TMSA_PI.Get_PI_List(null, "", null, null, ref rowcount).Tables[0]; ddlPIList.DataSource = dt; ddlPIList.DataTextField = "Name"; ddlPIList.DataValueField = "PI_ID"; ddlPIList.DataBind(); ddlPIList.Items.Insert(0, new ListItem("-Select-", "0")); }
protected void BindGrid() { try { int rowcount = ucCustomPager1.isCountRecord; string SearchText = txtSearch.Text; string Category = null; if (ddlCategory.SelectedIndex == 0) { Category = ""; } else { Category = ddlCategory.SelectedValue; } DataTable dt = null; DataSet DS = BLL_TMSA_PI.Get_PI_List(SearchText, Category, ucCustomPager1.CurrentPageIndex, ucCustomPager1.PageSize, ref rowcount); if (DS.Tables.Count != 0) { dt = DS.Tables[0]; btnExport.Visible = true; if (ucCustomPager1.isCountRecord == 1) { ucCustomPager1.CountTotalRec = rowcount.ToString(); ucCustomPager1.BuildPager(); } if (dt.Rows.Count > 0) { gvPIList.DataSource = dt; gvPIList.DataBind(); } else { gvPIList.DataSource = null; gvPIList.DataBind(); } } else { gvPIList.DataSource = null; gvPIList.DataBind(); } } catch (Exception ex) { } }
protected void btnExport_Click(object sender, ImageClickEventArgs e) { int rowcount = ucCustomPager1.isCountRecord; string SearchText = txtSearch.Text; string Category = null; if (ddlCategory.SelectedIndex == 0) { Category = ""; } else { Category = ddlCategory.SelectedValue; } DataTable dt = null; dt = BLL_TMSA_PI.Get_PI_List(SearchText, Category, null, null, ref rowcount).Tables[0]; string[] HeaderCaptions = { "PI Name", "Code", "Interval", "Description", "Unit", "Status" }; string[] DataColumnsName = { "Name", "Code", "Interval", "Description", "UOM", "Status" }; GridViewExportUtil.ExportToExcel(dt, HeaderCaptions, DataColumnsName, "PI List", "PI List"); }