一.Repeater控件的应用:
1.DataGrid控件对数据输出格式是自动生成HtmlTable标记的,DataList控件也是这样,它根据数据内容来生成数据控制表格。而Repeater控件是模板化的数据绑定列表,Repeater控件是“无外观的”,即:它不具有任何内置布局或样式,也就不会产生任何数据控制表格来控制数据的显示。因此,我们必须在控件的模板中明确声明所有HTML 布局标记、格式标记和样式标记。
Repeater控件是个轻量级的数据绑定控件,一般用它来输出要求相对简单的数据。
下面就是一个Repeater的应用:
<asp:Repeater runat="server" ID="Repeater_NEWS"OnItemCommand="Repeater_NEWS_ItemCommand">
<HeaderTemplate>
<table width="100%" border="0" cellspacing="1"cellpadding="1" class="STYLE4"bgcolor="#717171">
<tr bgcolor="#E8EFF4" height="23" align="center"class="STYLE5">
<td width="50px"class="STYLE5">序号</td>
<tdwidth="70px">是否置顶</td>
<td>标题</td>
<tdwidth="80px">类型</td>
<tdwidth="80px">审核状态</td>
<tdwidth="90px">类型注册时间</td>
<tdwidth="50px">操作</td>
<tdwidth="50px">操作</td>