62,074
社区成员
发帖
与我相关
我的任务
分享
private void BindMeishiyule()
{
DataTable table = main.GetMeishiyule();
string str = "<table style='font-size:12px;' width='324' height='264' cellspacing='2'><tr>";
for (int i = 0; i < table.Rows.Count; i++ )
{
DataRow row = table.Rows[i];
//获取图片路径
string localpath = Directory.GetParent("../Images/info/").FullName + "/" + row["ip_image"].ToString();
str += "<td heigth='132'><a href='#'>"
+"<img border='0' height='90' width='90' src='" + localpath + "'/></a><br/>"
+"<span style='color:red;'><a href='#'>" + row["Ip_Ftitle"]
+ "</a></span></td>";
//没行显示3张图片
if (i == 2)
str += "</tr><tr>";
if (i == table.Rows.Count - 1)
str += "</tr>";
}
str += "</table>";
//将拼凑的html放入div( meishiyule div的ID,作为服务器控件运行)
this.meishiyule.InnerHtml = str;
}