非数据器容器 前台页面绑定数据
实例一:<%=Session["UserName"]%>
实例二: <td colspan="3" rowspan="3" style="color: black; height: 23px; text-align: left;">
<%=GetList()%>
</td>
说明:没有在数据器的(repeater datalist gridview)前台绑定的
后台代码:
public string GetList()
{
SqlData da = new SqlData();
SqlDataReader dr = da.ExceRead("select top 5 * from tb_Vote ");
string strBody = "<table width=150 align=center>";
while (dr.Read())//循环读取
{
strBody += "<tr><td class=tableBottom>·<a href=vote.aspx?ID=" + dr["ID"] + " >" + dr["Title"].ToString() + "</a></td></tr>\n";
}
dr.Close();//关闭阅读器
strBody += "</table>";
return strBody;
}