以下是用户控件代码:
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> ";
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);断点追踪能看到从数据库取出内容,但就是不显示出来,不知道问题在哪里。
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> ";
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);断点追踪能看到从数据库取出内容,但就是不显示出来,不知道问题在哪里。
上面的帖错了,实际是这个。
Table1=new HtmlTable();在页面显示了吗?
Table1=new HtmlTable();在页面显示了吗???
Table1=new HtmlTable();在页面显示了吗???没有显示
Table1=new HtmlTable();
原因是这个,页面上已经放了一个TABLE的实例了,在程序里又实例了一次。