protected void BindGrid() { try { string category = ddlCategory.SelectedValue; if (ddlCategory.SelectedIndex == 0) { category = ""; } int rowcount = ucCustomPager1.isCountRecord; DataTable dt = BLL_TMSA_PI.Get_KPI_List(txtSearch.Text, ucCustomPager1.CurrentPageIndex, ucCustomPager1.PageSize, ref rowcount, category).Tables[0]; if (dt.Rows.Count > 0) { btnExport.Visible = true; } if (ucCustomPager1.isCountRecord == 1) { ucCustomPager1.CountTotalRec = rowcount.ToString(); ucCustomPager1.BuildPager(); } gvKPIList.DataSource = dt; gvKPIList.DataBind(); } catch (Exception ex) { } }
protected void BindGrid() { try { string category = ""; int rowcount = 1; DataTable dt = BLL_TMSA_PI.Get_KPI_List("", 1, 100, ref rowcount, category).Tables[0]; gvKPIList.DataSource = dt; gvKPIList.DataBind(); } catch (Exception ex) { UDFLib.WriteExceptionLog(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_KPI_List(SearchText, null, null, ref rowcount, Category).Tables[0]; string[] HeaderCaptions = { "KPI Name", "Code", "Interval", "Description", "Status" }; string[] DataColumnsName = { "Name", "Code", "Interval", "Description", "KPI_Status" }; GridViewExportUtil.ExportToExcel(dt, HeaderCaptions, DataColumnsName, "KPI List", "KPI List"); }
private void GenearteDiv2(string category) { PlaceHolder2.Controls.Clear(); int rowcount = 0; DataTable dt = BLL_TMSA_PI.Get_KPI_List("", null, null, ref rowcount, category).Tables[0]; var InActiveCount = dt.AsEnumerable().Where(r => r.Field <string>("KPI_STATUS") == "InActive").Count(); if (InActiveCount > 0) { dt.Rows.Remove(dt.AsEnumerable().Where(r => r.Field <string>("KPI_STATUS") == "InActive").FirstOrDefault()); } string[] arrKPI = new string[dt.Rows.Count]; string[] name = new string[dt.Rows.Count]; string[] URL = new string[dt.Rows.Count]; for (int k = 0; k < dt.Rows.Count; k++) { arrKPI[k] = dt.Rows[k]["KPI_ID"].ToString(); name[k] = dt.Rows[k]["name"].ToString(); URL[k] = dt.Rows[k]["URL"].ToString(); } hiddenKPIID.Value = String.Join(",", arrKPI); hiddenName.Value = String.Join(",", name); int totalKPI = dt.Rows.Count; int tblRows = 1; int tblCols = 1; if (totalKPI > 1) { if (totalKPI < 3) { tblRows = 1; tblCols = 2; } else if (totalKPI < 5) { tblRows = 2; tblCols = 2; } else { tblCols = 3; tblRows = (int)Math.Ceiling((double)totalKPI / 3); } } Table tbl = new Table(); tbl.Attributes.Add("align", "center"); PlaceHolder2.Controls.Add(tbl); //TableRow tr = new TableRow(); string sURL; int iCount = 0; for (int i = 0; i < tblRows; i++) { TableRow tr = new TableRow(); for (int j = 0; j < tblCols; j++) { TableCell tc = new TableCell(); HtmlGenericControl newControl = new HtmlGenericControl("div"); newControl.ID = "chartContainer2_" + i + j; newControl.Attributes.Add("Style", "Height:300px;width:600px;float:left"); // newControl.Attributes.Add("onclick", "redirect()"); if (iCount < totalKPI) { sURL = URL[iCount].ToString(); if (sURL != null && sURL != "") { newControl.Attributes.Add("onclick", "redirect('" + sURL + "')"); } } newControl.InnerHtml = ""; tc.Controls.Add(newControl); tr.Cells.Add(tc); iCount++; } tbl.Rows.Add(tr); } hiddenCount.Value = tblRows.ToString(); hiddenCount1.Value = tblCols.ToString(); }