以下是用户控件代码:
Business.HotBusiness.ListHotBusiness[] hot=Business.HotBusiness.HotBusinessList();
Table1=new HtmlTable();

Table2=new HtmlTable();
row=new HtmlTableRow();
cell=new HtmlTableCell();
cell.Height="23";
cell.Width="147"; cell.Attributes.Add("background",hot[0].TypePic);
cell.InnerHtml=hot[0].Type;
row.Cells.Add(cell);
Table2.Rows.Add(row); row=new HtmlTableRow();
cell=new HtmlTableCell();
cell.BgColor=hot[0].BackColor;
cell.InnerHtml="<a href=hot.aspx?id="+hot[0].Id+"><img border=0 src="+hot[0].HotPic+" alt="+NoHTML(hot[0].HotName)+" ></a>";
row.Cells.Add(cell);
Table2.Rows.Add(row); row=new HtmlTableRow();
cell=new HtmlTableCell();
cell.BgColor=hot[0].BackColor;
cell.InnerHtml="<a href=hot.aspx?id="+hot[0].Id+">"+hot[0].HotName+"</a>";
row.Cells.Add(cell);
Table2.Rows.Add(row); row=new HtmlTableRow();
cell=new HtmlTableCell();
cell.Attributes.Add("background",hot[0].MorePic);
cell.InnerHtml="<a href=hot.aspx?id="+hot[0].Id+"><font color=#ffffff>...More</font></a>&nbsp;&nbsp;";
row.Cells.Add(cell);
Table2.Rows.Add(row); row=new HtmlTableRow();
cell=new HtmlTableCell();
cell.Controls.Add(Table2);
row.Cells.Add(cell);
Table1.Rows.Add(row);以下是页面代码:
protected WINTIMES.UserControl.hot1 hot;
hot=(UserControl.hot1)this.LoadControl("UserControl/hot1.ascx");
row0=new HtmlTableRow();
cell0=new HtmlTableCell();
cell0.Controls.Add(uchot);
row0.Cells.Add(cell0);
Table6.Rows.Add(row0);断点追踪能看到从数据库取出内容,但就是不显示出来,不知道问题在哪里。

解决方案 »

  1.   

    cell0.Controls.Add(hot);
    上面的帖错了,实际是这个。
      

  2.   

    那就是你控件的问题了
    Table1=new HtmlTable();在页面显示了吗?
      

  3.   

    那就是你控件的问题了
    Table1=new HtmlTable();在页面显示了吗???
      

  4.   

    那就是你控件的问题了
    Table1=new HtmlTable();在页面显示了吗???没有显示
      

  5.   

    汗那,找到原因了,
    Table1=new HtmlTable();
    原因是这个,页面上已经放了一个TABLE的实例了,在程序里又实例了一次。