| 发表于:2007-08-17 13:55:11 楼主 |
问下高手,我用table嵌套table这个主从表关系的控件,为什么嵌套的table显示不出数据,大家帮帮忙! dataset ds = data.gettocourse(userid); int length = ds.tables[0].rows.count; if (length != 0) { #region 添加表格标题 tablerow rowtitle = new tablerow(); string[] title = new string[2] { "课程单元 ", "课程目录 " }; int[] width = new int[2] { 160, 237 }; for (int j = 0; j < 2; j++) { tablecell celltitle = new tablecell(); celltitle.controls.add(new literalcontrol(title[j])); celltitle.cssclass = ".center "; celltitle.width = width[j]; celltitle.height = 30; celltitle.horizontalalign = horizontalalign.center; rowtitle.cells.add(celltitle); } table1.rows.add(rowtitle); #endregion for (int i = 0; i < length; i++) { tablerow row = new tablerow(); table1.rows.add(row); tablecell cellunit = new tablecell(); cellunit.text = "   " + ds.tables[0].rows[i].itemarray[2].tostring(); cellunit.horizontalalign = horizontalalign.left; row.cells.add(cellunit); table tablecatalog = new table(); tablecatalog.width = 237; tablecatalog.horizontalalign = horizontalalign.center; tablecatalog.enableviewstate = false; for (int j = 0; j < length; j++) { dataset ds1 = data.gettypecourse(userid); tablerow rowcatalog = new tablerow(); tablecatalog.rows.add(rowcatalog); tablecell cellcourse = new tablecell(); cellcourse.text = "   " + ds1.tables[0].rows[j].itemarray[1].tostring(); cellcourse.horizontalalign = horizontalalign.left; rowcatalog.cells.add(cellcourse); response.write(cellcourse.text); } } } |
|
|
|
|