日期:2014-05-17 浏览次数:20748 次
public commentBO(int weiboid, int page)
{
Content = "";
string linkhtml = string.Empty;
int pgCount = 1;
dt = cs.GetAllComments(weiboid,page);
for (int i = 0; i < dt.Rows.Count; i++)
{
string fatherid = dt.Rows[i][1].ToString();
users = us.GetUserByUserid(Convert.ToInt32(dt.Rows[i][5]));
string photo = "Upload/" + users.Photo;
string Cname = users.Username;
int aaa = 33;
string time =dt.Rows[i][3].ToString();
string commentContent = dt.Rows[i][6].ToString();
Content += "<div class=\"codivcontent\">";
Content += "<div class=\"cocontent\">";
Content += "<div class=\"codivimg\">";
Content += "<img src=\""+photo+"\" width=\"35px\"/>";//头像
Content += "</div>";
Content += "<div class=\"codivtxt\">";
Content += "<a href=\"javascript:void(0)\">" + Cname + "</a>:";//////姓名
Content += "<a href=\"javascript:void(0)\">";
Content += "<em class=\"commentem\">" + commentContent + "(" + time + ")</em>";///////评论内容
Content += "</a>";
Content += "</div>";
Content += "</div>";
Content += "<div class=\"commentreply\">";
/////////////////问题部分。
Content += "<a href=\"javascript:void(0)\" onclick=\"reply(" + fatherid + ",$(this).parent().parent().parent().parent().attr('id')," + weiboid + ",333,$(this).parent().parent().parent().attr('id'))\">";
/////////////////问题部分。在给reply参数赋值的时候,第四个参数也就是'333'那儿,int 类型的都可以,但是只要改成string的就不行了。我试过另一个类似的类里可以用的js方法,到这里之后就不可以了,参数类型都是一样的。
Content += "回复</a>";
Content += "</div>";
Content += "</div>";
}
int rescount = cs.GetCount(weiboid);
Content += "<div class=\"pages\">已有" + rescount + "条评论 {$link_list$}</div>";
pgCount = (rescount / pagesize) + 1;
if (pgCount > 1)
{
for (int j = 0; j < pgCount; j++)
{
int pagenum = j + 1;
linkhtml = linkhtml + ((j == page) ? "<span class=\"current\">" + pagenum + "</span> " : "<a href=\"javascript:void(0)\" onclick=\"getcomment(" + weiboid + "," + j + ",$(this).parent().parent().attr('id'))\">" + pagenum + "</a> ");
}
}
else
{
linkhtml = "";
}
Content = Content.Replace("{$link_list$}", linkhtml);
}
function reply(fatherid, fatherdiv, weiboid, username, allcomme