public void QueryASPxGridView() { GridView1.DataSource = null; GridView1.DataBind(); Baojia_Report_sql BaojiaSQLHelp = new Baojia_Report_sql(); DataTable dt = BaojiaSQLHelp.Get_Baojia_history_update_data(this.txtBaojia_no.Text.ToString(), this.txtCustomer_name.Text.ToString(), this.ddl_update_user.SelectedValue.ToString() ); this.GridView1.DataSource = dt; GridView1.DataBind(); //合并单元格 int[] cols = { 0, 1, 2, 3, 4, 5, 9, 10, 11 }; MergGridRow.MergeRow(GridView1, cols); int rowIndex = 1; for (int j = 0; j < GridView1.Rows.Count; j++) { if (GridView1.Rows[j].Cells[0].Visible == true) { GridView1.Rows[j].Cells[0].Text = rowIndex.ToString(); HyperLink link = new HyperLink(); link.ID = "link" + rowIndex.ToString(); link.NavigateUrl = "Baojia.aspx?requestid=" + Server.HtmlDecode(GridView1.Rows[j].Cells[11].Text).Trim() + "&update=1"; link.Text = GridView1.Rows[j].Cells[1].Text; link.Target = "_blank"; GridView1.Rows[j].Cells[1].Controls.Add(link); rowIndex++; } } }
public void QueryASPxGridView() { GridView1.DataSource = null; GridView1.DataBind(); Baojia_Report_sql BaojiaSQLHelp = new Baojia_Report_sql(); DataTable dt = BaojiaSQLHelp.Get_Baojia_Task_Query_Data(this.ddlyear.SelectedValue.ToString(), this.txt_startdate.Text, this.txt_enddate.Text, this.ddlBaojiaStatus.SelectedValue.ToString(), this.ddlsign_status.SelectedValue.ToString(), this.txt_date.Value, this.ddlzzgc.SelectedValue.ToString(), this.ddl_depart.SelectedValue.ToString(), this.ddl_update_user.SelectedValue.ToString(), this.ddl_ISDelay.SelectedValue.ToString() ); this.GridView1.DataSource = dt; GridView1.DataBind(); int[] cols = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 17, 18 }; MergGridRow.MergeRow(GridView1, cols); //获取最新的requestid int visbleRow = 0; for (int j = 0; j <= GridView1.Rows.Count - 1; j++) { if (GridView1.Rows[j].Cells[0].Visible == true) { visbleRow = j; } else { GridView1.Rows[visbleRow].Cells[18].Text = GridView1.Rows[j].Cells[18].Text; } } int rowIndex = 1; for (int j = 0; j < GridView1.Rows.Count; j++) { if (GridView1.Rows[j].Cells[0].Visible == true) { GridView1.Rows[j].Cells[0].Text = rowIndex.ToString(); HyperLink link = new HyperLink(); link.ID = "link" + rowIndex.ToString(); link.NavigateUrl = "Baojia.aspx?requestid=" + Server.HtmlDecode(GridView1.Rows[j].Cells[18].Text).Trim(); link.Text = GridView1.Rows[j].Cells[1].Text; link.Target = "_blank"; GridView1.Rows[j].Cells[1].Controls.Add(link); rowIndex++; } } }
public void QueryASPxGridView() { GridView1.DataSource = null; GridView1.DataBind(); Baojia_Report_sql BaojiaSQLHelp = new Baojia_Report_sql(); DataTable dt = BaojiaSQLHelp.Get_Baojia_Process_Query_Data(this.txtBaojia_no.Text.ToString(), this.txtCustomer_name.Text.ToString(), this.txtRenyuan.Text.ToString(), this.ddlBaojia_status.SelectedValue.ToString()); this.GridView1.DataSource = dt; GridView1.DataBind(); int[] cols = { 0, 1, 2, 3, 4, 8, 9, 10, 11, 12, 13, 14, 15, 17, 18 }; MergGridRow.MergeRow(GridView1, cols); //获取最新的requestid int visbleRow = 0; for (int j = 0; j <= GridView1.Rows.Count - 1; j++) { if (GridView1.Rows[j].Cells[0].Visible == true) { visbleRow = j; } else { GridView1.Rows[visbleRow].Cells[16].Text = GridView1.Rows[j].Cells[16].Text; } } int rowIndex = 1; for (int j = 0; j < GridView1.Rows.Count; j++) { if (GridView1.Rows[j].Cells[0].Visible == true) { GridView1.Rows[j].Cells[0].Text = rowIndex.ToString(); HyperLink link = new HyperLink(); link.ID = "link" + rowIndex.ToString(); link.NavigateUrl = "Baojia.aspx?requestid=" + Server.HtmlDecode(GridView1.Rows[j].Cells[16].Text).Trim(); link.Text = GridView1.Rows[j].Cells[1].Text; link.Target = "_blank"; GridView1.Rows[j].Cells[1].Controls.Add(link); rowIndex++; } } }
public void BindGridviewDTL(string condition, string project_level, string value) { Baojia_Report_sql BaojiaSQLHelp = new Baojia_Report_sql(); DataTable ds = BaojiaSQLHelp.Get_Baojia_FenXi_ZD_Project_dtl(condition, project_level, value); this.GridView1.DataSource = ds; GridView1.DataBind(); GridView1.Rows[GridView1.Rows.Count - 1].Cells[17].Text = ""; GridView1.Rows[GridView1.Rows.Count - 1].Cells[2].Text = ""; GridView1.Rows[GridView1.Rows.Count - 1].Cells[3].Text = ""; GridView1.Rows[GridView1.Rows.Count - 1].BackColor = System.Drawing.Color.LightYellow; /* * int[] cols = { 0, 1, 2, 3, 4, 5, 6, 15, 17, 18, 19 }; * * MergGridRow.MergeRow(GridView1, cols); * int visbleRow = 0; * for (int j = 0; j <= GridView1.Rows.Count - 1; j++) * { * if (GridView1.Rows[j].Cells[0].Visible == true) * { * visbleRow = j; * } * else * { * GridView1.Rows[visbleRow].Cells[19].Text = GridView1.Rows[j].Cells[19].Text; * } * * } */ int[] cols = { 0, 1, 2, 3, 4, 5, 6, 17, 18, 19 }; MergGridRow.MergeRow(GridView1, cols); int[] cols2 = { 0, 15 }; MergGridRow.MergeRow(GridView1, cols2); int visbleRow = 0; for (int j = 0; j <= GridView1.Rows.Count - 1; j++) { if (GridView1.Rows[j].Cells[0].Visible == true) { visbleRow = j; } else { GridView1.Rows[visbleRow].Cells[19].Text = GridView1.Rows[j].Cells[19].Text; } } int rowIndex = 1; for (int j = 0; j < GridView1.Rows.Count - 1; j++) { if (GridView1.Rows[j].Cells[0].Visible == true) { GridView1.Rows[j].Cells[0].Text = rowIndex.ToString(); HyperLink link = new HyperLink(); link.ID = "link" + rowIndex.ToString(); link.NavigateUrl = "Baojia.aspx?requestid=" + Server.HtmlDecode(GridView1.Rows[j].Cells[20].Text).Trim(); link.Text = GridView1.Rows[j].Cells[1].Text; link.Target = "_blank"; GridView1.Rows[j].Cells[1].Controls.Add(link); rowIndex++; } GridView1.Rows[j].Cells[17].Attributes.Add("onclick", "OpenMsg(this.firstElementChild,'" + condition + "');"); } }