[ASP.net]DataGrid自定义模版前端代码

类别:Asp 点击:0 评论:0 推荐:
<asp:datagrid id="dgList" style="Z-INDEX: 101; LEFT: 8px; POSITION: absolute; TOP: 8px" runat="server" CellPadding="0" GridLines="None" Width="100%" PageSize="2" AllowPaging="True" AutoGenerateColumns="False" ShowFooter="True">
     <AlternatingItemStyle BackColor="#777777"></AlternatingItemStyle>
     <Columns>
      <asp:TemplateColumn>
       <HeaderStyle Font-Size="X-Small" HorizontalAlign="Center" ForeColor="Blue" BackColor="#FFCC66"></HeaderStyle>
       <ItemStyle Font-Size="X-Small" HorizontalAlign="Center"></ItemStyle>
       <HeaderTemplate>
        <div>
         <table width="100%" bgcolor="#cc9966">
          <tr>
           <td><span>HeaderFonts</span></td>
          </tr>
         </table>
        </div>
       </HeaderTemplate>
       <ItemTemplate>
        <div>
         <table width="100%">
          <tr>
           <td>
            <%#DataBinder.Eval(Container.DataItem,"ID")%>
           </td>
           <td>
            <%#DataBinder.Eval(Container.DataItem,"Caption")%>
           </td>
          </tr>
          <tr>
           <td>
            <%#DataBinder.Eval(Container.DataItem,"content")%>
           </td>
          </tr>
         </table>
        </div>
       </ItemTemplate>
       <FooterTemplate>
        <div>
         <table width="100%" bgcolor="#cc6666">
          <tr>
           <td><span>FooterFonts</span></td>
          </tr>
         </table>
        </div>
       </FooterTemplate>
      </asp:TemplateColumn>
     </Columns>
     <PagerStyle NextPageText="&lt;B&gt;下一頁&lt;/B&gt;" PrevPageText="&lt;B&gt;上一頁&lt;/B&gt;" HorizontalAlign="Center" BackColor="Olive"></PagerStyle>
    </asp:datagrid>

本文地址:http://com.8s8s.com/it/it8361.htm