具有固定标题和排序功能的可滚动gridview

时间:2013-06-21 11:31:50

标签: c# asp.net

我想实现一个带有固定标题的可滚动网格视图,包括对标题进行排序的功能(代码如下所示)。请提供建议。

<div style="overflow: scroll; width: 100%; height: 350px">   
<asp:GridView id="GridView1" runat="server" Width="754px"
OnRowDataBound="GridView1_RowDataBound"DataKeyNames="UniqueID" 
GridLines="None"  ForeColor="#333333" 
EmptyDataText="There are no data records to display."
DataSourceID="sdsMapsAdd" CellPadding="4" AutoGenerateColumns="False"
AllowSorting="True" AllowPaging="False"  OnRowCommand="GridView1_RowCommand"
OnSelectedIndexChanged="GridView1_SelectedIndexChanged">
<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<Columns>
<asp:CommandField ShowSelectButton="True" />
<asp:BoundField DataField="ID" HeaderText="ID" ReadOnly="True"  SortExpression="UniqueID" Visible="false"   />
<asp:BoundField DataField="Name" HeaderText="Name"  ReadOnly="True" SortExpression="SiteName" />
<asp:BoundField DataField="Address" HeaderText="Address" SortExpression="Address" />
</Columns>
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
<EditRowStyle BackColor="#999999" />
<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White"  />
<AlternatingRowStyle BackColor="White" ForeColor="#284775" />
</asp:GridView>
</div>

0 个答案:

没有答案