HtmlTableRow row=null;
HtmlTableCell cell=null;dvDetail = new DataView(ds.Tables[2]);for (int i = 0; i < dvDetail.Count; i++){row = new HtmlTableRow();for (int l = 0; l < 10; l++){cell = new HtmlTableCell(){InnerText = dvDetail[i].Row[_COL[l]].ToString()};cell.Style.Add(“background-color”, “#f2f2f2 !important”);row.Cells.Add(cell);}tbDetail.Rows.Add(row);}setCell(tbDetail, 0, 44, 2, 10);
private void setCell(HtmlTable tbl, int begin, int end, int titleRowCount, int colCount)
{int intRow = 0;int intCount = 1;bool flag = false;for (int i = begin + titleRowCount; i < end + titleRowCount; i++){if (!flag){intRow = i;flag = true;}if (i + 1 <= end + titleRowCount - 1 && tbl.Rows[i].Cells[0].InnerText == tbl.Rows[i + 1].Cells[0].InnerText){intCount++;}else{if (intCount > 1){for (int j = intRow; j < intRow + intCount; j++){if (j == intRow){tbl.Rows[j].Cells[0].RowSpan = intCount;if (jinkakuFlg.Value == “0”)tbl.Rows[j].Cells[9].RowSpan = intCount;}else{tbl.Rows[j].Cells[0].Style.Add(“display”, “none”);if (jinkakuFlg.Value == “0”)tbl.Rows[j].Cells[9].Style.Add(“display”, “none”);}}}intCount = 1;flag = false;}//if (!Convert.ToBoolean(i % 2))//{// for (int k = 1; k < colCount; k++)// {// tbl.Rows[i].Cells[k].Style.Add(“background-color”, “#ffffff !important”);// }//}for (int k = 0; k < colCount; k++){if (k == 2 || k == 4){tbl.Rows[i].Cells[k].Style.Add(“background-color”, “#ffffff !important”);}if (k == 0 || k == 9){tbl.Rows[i].Cells[k].Style.Add(“text-align”, “center !important”);}}}}