Solved

ASP.Net Datagrid - Scrolls and Sorts on Headers - Can I fix the Header as Well?

Posted on 2009-07-08
2
228 Views
Last Modified: 2012-06-22
The title pretty much says it all. I just want the headers to stay put while I'm scrolling through the data. The existing code is below.

Thanks!!
<div style= "height:300px; overflow:auto;">           	     
	        <asp:GridView ID="GridView1" DataSourceID="SqlDataSource1" runat="server" DataKeyNames="Sequence"
            ForeColor="Black" ShowFooter="True" CellPadding="5"                  
            BackColor="White" BorderWidth="1px" BorderStyle="None" BorderColor="#CCCCCC" 
                 Height="135px" AllowSorting="True" AutoGenerateColumns="False">
                <Columns>
                    <asp:BoundField DataField="Dept" HeaderText="Department" ReadOnly="True"
                        SortExpression="Dept" />
                    <asp:BoundField DataField="DeptNum" HeaderText="Dept #" SortExpression="DeptNum" />
                    <asp:BoundField DataField="ZoneMgr" HeaderText="Zone Mgr" ReadOnly="True"
                        SortExpression="ZoneMgr" />
                    <asp:BoundField DataField="Phone" HeaderText="Phone" ReadOnly="True" 
                        SortExpression="Phone" />
                    <asp:BoundField DataField="Email" HeaderText="Email" ReadOnly="True" 
                        SortExpression="Email" />
                    <asp:BoundField DataField="BackupZM" HeaderText="Backup Zone Mgr" ReadOnly="True" 
                        SortExpression="BackupZM" />
                    <asp:BoundField DataField="BackupPhone" HeaderText="Backup Phone" ReadOnly="True" 
                        SortExpression="Backup Phone" />
                    <asp:BoundField DataField="BackupEmail" HeaderText="Backup Email" ReadOnly="True" SortExpression="BackupEmail" />
                 </Columns>
            <HeaderStyle Font-Bold="true" Wrap="false" ForeColor="White" BackColor="#333333" /> 
            <FooterStyle Font-Bold="true" Wrap="false" ForeColor="White" BackColor="#333333" />                
            <AlternatingRowStyle Font-Bold="True" Wrap="False" ForeColor="black" BackColor="#CCCC99"></AlternatingRowStyle>
            </asp:GridView>
   </div> <!-- end gridview-container -->             
	        <asp:SqlDataSource ID="SqlDataSource1" runat="server"
	            SelectCommand="SELECT * FROM [ZMDeptsList]"
                ConnectionString="<%$ ConnectionStrings:MyConnection %>"                  
                DataSourceMode="DataSet">
             </asp:SqlDataSource>

Open in new window

0
Comment
Question by:JB4375
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 8

Accepted Solution

by:
MrAgile earned 500 total points
ID: 24809241
0
 
LVL 1

Author Closing Comment

by:JB4375
ID: 31601331
Thanks. I'd seen some of these but I think the code project article might do the trick.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question