Solved

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

Posted on 2009-07-08
2
211 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
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

744 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now