您的位置:程序门 -> .net技术 -> asp.net



table嵌套table问题


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


table嵌套table问题[已结贴,结贴人:jy00361722]
发表于: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   =   "&nbsp;&nbsp;&nbsp;&nbsp "   +   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   =   "&nbsp;&nbsp;&nbsp;&nbsp "   +   ds1.tables[0].rows[j].itemarray[1].tostring();
                                        cellcourse.horizontalalign   =   horizontalalign.left;
                                        rowcatalog.cells.add(cellcourse);
                                        response.write(cellcourse.text);
                                }
                        }
                }
发表于:2007-08-17 13:57:311楼 得分:0
关注一下
发表于:2007-08-17 17:23:112楼 得分:0
up
发表于:2007-08-17 18:28:293楼 得分:30
up,一看楼主就是玩金庸出身的!
发表于:2007-08-18 11:25:574楼 得分:0
jf   up   学习
发表于:2007-08-20 18:04:135楼 得分:0
自己解决问题!


快速检索

最新资讯
热门点击