两种GridView的表格样式

1.第一种样式

GridView表格样式
<body>
<form id="form1" runat="server">
<div>
<asp:GridView ID="gvList" runat="server" AutoGenerateColumns="False" BorderColor="#337FB2"
BorderWidth
="2px" CellPadding="4" Font-Size="Small" ForeColor="#333333" Height="32%"
OnRowDataBound
="gvList_RowDataBound" Width="100%">
<columns>
<asp:BoundField HeaderText="编号">
<itemstyle Width="5%" /> </asp:BoundField>
<asp:BoundField DataField="U_Name" HeaderText="用户名">
<itemstyle Width="10%" /> </asp:BoundField>
<asp:BoundField DataField="U_State" HeaderText="状态">
<itemstyle Width="10%" /> </asp:BoundField>
<asp:BoundField DataField="U_IP" HeaderText="IP">
<itemstyle Width="25%" /> </asp:BoundField>
<asp:BoundField DataField="L_Date" HeaderText="时间">
<itemstyle Width="5%" /> </asp:BoundField>
</columns>
<RowStyle BackColor="White" Font-Bold="True" Font-Size="Small" ForeColor="#003399"
HorizontalAlign
="Center" />
<EditRowStyle BackColor="#999999" />
<SelectedRowStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
<pagerstyle BackColor="#337FB2" ForeColor="White" HorizontalAlign="Center" VerticalAlign="Middle" />
<headerstyle BackColor="#337FB2" CssClass="BODY" Font-Size="12px" ForeColor="White"
HorizontalAlign
="Center" VerticalAlign="Middle" />
<AlternatingRowStyle BackColor="#E8F4FF" Font-Bold="True" Font-Size="Small" HorizontalAlign="Center" />
<footerstyle BackColor="#A6A1E0" Font-Bold="True" ForeColor="White" />
</asp:GridView>


</div>
</form>
</body>

2、第二种样式

GridView表格样式
        <asp:GridView ID="GridView1" runat="server" AllowSorting="True" AutoGenerateColumns="False"
CellPadding
="4" Font-Size="9pt" HeaderStyle-CssClass="headStyle" Width="100%"
HorizontalAlign
="Center" ForeColor="#333333" OnRowDataBound="GridView1_RowDataBound">
<FooterStyle BackColor="#990000" Font-Bold="True" />
<Columns>
<asp:BoundField DataField="LOGIN" Visible="false" HeaderText="登录名" />
<asp:TemplateField HeaderText="姓名">
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Eval("NAME") %>'></asp:Label>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:TemplateField HeaderText="上传文档">
<ItemTemplate>
<a href='UpLoadDetailList.aspx?LOGIN=<%#DataBinder.Eval(Container.DataItem,"LOGIN") %>'>
<%#DataBinder.Eval(Container.DataItem, "UPLOADDOCNUM")%></a>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:TemplateField HeaderText="下载文档">
<ItemTemplate>
<a href='DownLoadDetialList.aspx?LOGIN=<%#DataBinder.Eval(Container.DataItem,"LOGIN") %>'>
<%#DataBinder.Eval(Container.DataItem, "DOWNLOADNUM")%></a>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:TemplateField HeaderText="更新文档">
<ItemTemplate>
<a href='UpdateDetailList.aspx?LOGIN=<%#DataBinder.Eval(Container.DataItem,"LOGIN") %>'>
<%#DataBinder.Eval(Container.DataItem, "UPDATEDOCNUM")%></a>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
</Columns>
<RowStyle ForeColor="#333333" BackColor="#FFFBD6" />
<SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
<PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
<HeaderStyle BackColor="#AAAAFF" Font-Bold="True" ForeColor="White" />
</asp:GridView>



转载于:https://www.cnblogs.com/J-FoX/archive/2012/03/15/2398067.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值