td.Controls.Add(new LiteralControl("目前尚未有人发言!")) ;
tr.Cells.Add(td) ;
tblTopic.Rows.Add(tr) ;
}
else //否则,显示贴字列表
{
while (myReader.Read())
{
String strInnerHtml = "";
TableRow tr = new TableRow() ;
tr.BackColor = Color.White ;
//贴子状态图片
TableCell tdStatus = new TableCell() ;
if ((int)myReader["TotalChilds"] == 0)
{
strInnerHtml = "<img src='images/closed.gif' alt='没有新回复。'>" ;
}
else if((int)myReader["TotalChilds"] < 5)
{
strInnerHtml = "<img src='images/closedb.gif' alt='有新回复,不过不多。'>";
}
else if((int)myReader["TotalChilds"] >= 10)
{
strInnerHtml = "<img src='images/hotclosedb.gif' alt='太火了。'>";
}
else if((int)myReader["TotalChilds"] >= 5)
{
strInnerHtml = "<img src='images/hotclosed.gif' alt='回复不少。'>";
}
tdStatus.Controls.Add(new LiteralControl(strInnerHtml)) ;
tr.Cells.Add(tdStatus) ;
//表情图片
TableCell tdFace = new TableCell() ;
strInnerHtml = "<img src='images/icon"+myReader["FaceID"].ToString() +".gif'>" ;
//Response.Write(strInnerHtml) ;
tdFace.Controls.Add(new LiteralControl(strInnerHtml)) ;
tr.Cells.Add(tdFace) ;
//主题
TableCell tdTitle = new TableCell() ;
strInnerHtml = "<a href='ShowTopic.aspx?id=" + myReader["ID"].ToString() + "'>"
+ myReader["Title"].ToString() + "</a>";
tdTitle.Controls.Add(new LiteralControl(strInnerHtml)) ;
tr.Cells.Add(tdTitle) ;
//作者
TableCell tdAuthor = new TableCell() ;
strInnerHtml = myReader["UserName"].ToString() ;
tdAuthor.Controls.Add(new LiteralControl(strInnerHtml)) ;
tr.Cells.Add(tdAuthor) ;
//回复数
TableCell tdReply = new TableCell() ;
strInnerHtml = myReader["TotalChilds"].ToString() ;
tdReply.Controls.Add(new LiteralControl(strInnerHtml)) ;
tr.Cells.Add(tdReply) ;
//最后回复时间
TableCell tdReplyTime = new TableCell() ;
strInnerHtml = myReader["LastReplyTime"].ToString() ;
tdReplyTime.Controls.Add(new LiteralControl(strInnerHtml)) ;
tr.Cells.Add(tdReplyTime) ;
tblTopic.Rows.Add(tr) ;
 
上一页 [1] [2] [3] [4] 下一页