Repeater 绑定
前台容器Repeater的关键代码:
<!--列表展示.开始-->
<asp:Repeater ID="rptList" runat="server" onitemcommand="rptList_ItemCommand" OnItemDataBound="rptList_ItemDataBound">
<HeaderTemplate>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="msgtable">
<tr>
<th width="6%" align="left">第一列</th>
<th width="15%" align="left">第二列</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td><%#Eval("第一列ID")%></td>
<td><%#Eval("第二列ID")%></td>
</tr>
</ItemTemplate>
<FooterTemplate>
<%#rptList.Items.Count == 0 ? "<tr><td align=\"center\" colspan=\"7\">暂无记录</td></tr>" : ""%>
</table>
</FooterTemplate>
</asp:Repeater>
后台代码:
DataSet _invWasteDs = 获得的数据;
this.rptList.DataSource = _invWasteDs;
this.rptList.DataBind();