Repeater控件使用

来源:互联网 发布:软件开发绩效考核方案 编辑:程序博客网 时间:2024/06/12 14:47
<asp:Repeater ID="Repeater1" runat="server">
    
<%--SeparatorTemplate描述一个介于每条记录之间的分隔符--%>
    
<%--<SeparatorTemplate>
        
<tr>
        
<td colspan="5"><hr /></td>
        
</tr>
    
</SeparatorTemplate>--
%>
    
    
<HeaderTemplate>
      
<table border="1" cellpadding="0" cellspacing="0" style="width:1006px;border-collapse:collapse; text-align:center;">
      
<tr>
        
<td style="background-color:#cccccc; font-weight:bold; height:25px;"><input id="chkAll" name="chkAll" runat="server" type="checkbox" onclick="Check(this,'chkItem')" title="全选" /></td>
        
<td style="background-color:#cccccc; font-weight:bold; height:25px;">View</td>
        
<td style="background-color:#cccccc; font-weight:bold; height:25px;">CustomerID</td>
        
<td style="background-color:#cccccc; font-weight:bold;">CompanyName</td>
        
<td style="background-color:#cccccc; font-weight:bold;">ContactName</td>
        
<td style="background-color:#cccccc; font-weight:bold;">ContactTitle</td>
        
<td style="background-color:#cccccc; font-weight:bold;">Address</td>
      
</tr>
    
</HeaderTemplate>
    
<ItemTemplate>
      
<tr>
        
<td><asp:CheckBox ID="chkItem" runat="server" /></td>
        
<td><href='<%# "View.aspx?id="+DataBinder.Eval(Container.DataItem, "CustomerID") %>' target="_blank">View</a></td>
        
<td><asp:Label ID="lblID" Text='<%# DataBinder.Eval(Container.DataItem, "CustomerID")%>' runat="server"></asp:Label></td>
        
<td><%# Eval("CompanyName")%></td>
        
<td><%# Eval( "ContactName")%></td>
        
<td><%# Eval( "ContactTitle")%></td>
        
<td><%# Eval( "Address")%></td>
      
</tr>
    
</ItemTemplate>
    
<%--AlternatingItemTemplate描述交替输出行的另一种外观--%>
    
<AlternatingItemTemplate>
      
<tr bgcolor="#e8e8e8">
        
<td><asp:CheckBox ID="chkItem" runat="server" /></td>
        
<td><href='<%# "View.aspx?id="+DataBinder.Eval(Container.DataItem, "CustomerID") %>' target="_blank">View</a></td>
        
<td><asp:Label ID="lblID" Text='<%# DataBinder.Eval(Container.DataItem, "CustomerID")%>' runat="server"></asp:Label></td>
        
<td><%# Eval("CompanyName")%></td>
        
<td><%# Eval( "ContactName")%></td>
        
<td><%# Eval( "ContactTitle")%></td>
        
<td><%# Eval( "Address")%></td>
      
</tr>
    
</AlternatingItemTemplate>
    
<FooterTemplate>
     
</table>
    
</FooterTemplate>
</asp:Repeater>
原创粉丝点击