首页 > 代码库 > gridview 合并列
gridview 合并列
//gridview 相同列合并 private void GroupRows(GridView grv) { string[] drs = { "ConferenceStartDate", "ddd" }; int num = 1; for (int j = num - 1; j < grv.Rows.Count - 1; j++) //循环行 { int r = 1; num = 1; GridViewRow gvr = grv.Rows[j];//前一行的单元格 for (int i = j + 1; i < grv.Rows.Count; i++)//下一行 { if (r < 2) { GridViewRow gvrNext = grv.Rows[i]; HiddenField hidpersonname = grv.Rows[j].FindControl("hidpersonname") as HiddenField; HiddenField HidSign = grv.Rows[j].FindControl("HidSign") as HiddenField; HiddenField hidUnitID = grv.Rows[j].FindControl("hidUnitID") as HiddenField; HiddenField Hiduintnum = grv.Rows[j].FindControl("Hiduintnum") as HiddenField; HiddenField hidpersonname1 = grv.Rows[i].FindControl("hidpersonname") as HiddenField; HiddenField HidSign1 = grv.Rows[i].FindControl("HidSign") as HiddenField; HiddenField hidUnitID1 = grv.Rows[i].FindControl("hidUnitID") as HiddenField; HiddenField Hiduintnum1 = grv.Rows[i].FindControl("Hiduintnum") as HiddenField; //Label lID1 = grv.Rows[j].FindControl("lbID" + drs[r].ToString()) as Label; //Label lID2 = grv.Rows[i].FindControl("lbID" + drs[r].ToString()) as Label; //Label l1 = grv.Rows[j].FindControl("lbSign" + drs[r].ToString()) as Label; //Label l2 = grv.Rows[i].FindControl("lbSign" + drs[r].ToString()) as Label; if (hidpersonname.Value =http://www.mamicode.com/= hidpersonname1.Value && HidSign.Value == HidSign1.Value && hidUnitID.Value == hidUnitID1.Value && Hiduintnum.Value == Hiduintnum1.Value)"lbID" + drs[r].ToString()) as Label; // Label lID2 = grv.Rows[i].FindControl("lbID" + drs[r].ToString()) as Label; // Label l1 = grv.Rows[j].FindControl("lbSign" + drs[r].ToString()) as Label; // Label l2 = grv.Rows[i].FindControl("lbSign" + drs[r].ToString()) as Label; // Label lbWork1 = grv.Rows[j].FindControl("lbWork" + drs[r].ToString()) as Label; // Label lbWork2 = grv.Rows[i].FindControl("lbWork" + drs[r].ToString()) as Label; // if (l1.Text == l2.Text && lID1.Text == lID2.Text && lbWork1.Text == lbWork2.Text) // { // num += 1; // gvrNext.Cells[r + 1].Visible = false; // gvr.Cells[r + 1].RowSpan = num; // } // else // { // num = 1; // break; // } //} //} } } }
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。