本文整理汇总了C#中Comments.TopThreeComments方法的典型用法代码示例。如果您正苦于以下问题:C# Comments.TopThreeComments方法的具体用法?C# Comments.TopThreeComments怎么用?C# Comments.TopThreeComments使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Comments
的用法示例。
在下文中一共展示了Comments.TopThreeComments方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: info
public void info()
{
string t = Request.QueryString["id"];
Brand brand = new Brand();
int brandid = int.Parse(t);
brand = brand.getBrandDetails(brandid.ToString());
brandlogo.Src = "Images/" + brand.Logo;
brandlogo.Width = 100;
brandlogo.Height = 80;
description.InnerText = brand.BrandDescription;
name.Text = brand.BrandName;
website.HRef = "http://" + brand.Website;
website.InnerText = brand.Website;
Comments comments = new Comments();
List<Comments> topcomments = comments.TopThreeComments(5);
Table tblComments = new Table();
tblComments.Width = Unit.Percentage(100);
tblComments.Height = Unit.Percentage(100);
TableRow tblrowcom = new TableRow();
TableCell tblcellcom = new TableCell();
for (int j = 0; j < topcomments.Count; j++)
{
tblcellcom.Text = topcomments[j].Comment;
tblrowcom.Cells.Add(tblcellcom);
tblComments.Controls.Add(tblrowcom);
tblcellcom = new TableCell();
tblrowcom = new TableRow();
tblcellcom.Text = topcomments[j].Date.ToString();
tblrowcom.Cells.Add(tblcellcom);
tblComments.Controls.Add(tblrowcom);
tblcellcom = new TableCell();
tblrowcom = new TableRow();
}
phbrand.Controls.Add(tblComments);
}
示例2: Addcomments
public void Addcomments(TableCell allcells,int num)
{
Table tblComments = new Table();
tblComments.Style.Add("background-color", "#EDEFF4");
tblComments.Width = Unit.Percentage(100);
tblComments.Height = Unit.Percentage(100);
TableRow tblrowcom = new TableRow();
TableCell tblcellcom = new TableCell();
Comments comments = new Comments();
List<Comments> topcomments = comments.TopThreeComments(num);
for (int j = 0; j < topcomments.Count; j++)
{
Security.UserInfo usr = new Security.UserInfo();
usr = usr.getUserProfile(topcomments[j].UserID.ToString());
Image imag = new Image();
imag.Width = 40;
imag.Height = 40;
tblcellcom.Width = 40;
imag.ImageUrl = "~/images/" + usr.PhotoUrl;
tblcellcom.Controls.Add(imag);
tblrowcom.Cells.Add(tblcellcom);
// Allrow.Style.Add("background-color", "#EDE9D3");
tblcellcom = new TableCell();
tblcellcom.Style.Add("align", "left");
Table tbl = new Table();
tbl.Width = Unit.Percentage(100);
TableRow tblrow = new TableRow();
TableCell tblcell = new TableCell();
tblcell.Text = usr.Fname + " " + usr.Lname + " commented on ";
tblcell.Style.Add("color", "blue");
tblrow.Cells.Add(tblcell);
tbl.Controls.Add(tblrow);
tblrow = new TableRow();
tblcell = new TableCell();
tblcell.Text = topcomments[j].Comment;
// tblcell.Style.Add("color", "blue");
tblrow.Cells.Add(tblcell);
tbl.Controls.Add(tblrow);
tblrow = new TableRow();
tblcell = new TableCell();
Button lbdelete = new Button();
tblcell.Controls.Add(lbdelete);
lbdelete.Text = " Delete " + topcomments[j].Date;
string v= HttpContext.Current.Request.Url.AbsoluteUri+"&dl="+ topcomments[j].BrandCommentID+"";
lbdelete.Attributes["onclick"]="javascript:window.location.replace('"+v+"');";
lbdelete.Style.Add("text-decoration", "none");
tblcell.Style.Add("color", "blue");
tblrow.Cells.Add(tblcell);
tbl.Controls.Add(tblrow);
tblrow = new TableRow();
tblcell = new TableCell();
tblcell.Controls.Add(new LiteralControl("<hr>"));
tblrow.Cells.Add(tblcell);
tbl.Controls.Add(tblrow);
tblcellcom.Controls.Add(tbl);
tblrowcom.Cells.Add(tblcellcom);
tblComments.Controls.Add(tblrowcom);
tblrowcom = new TableRow();
tblcellcom = new TableCell();
}
allcells.Controls.Add(tblComments);
}