Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 661709
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T23:17:50+00:00 2026-05-13T23:17:50+00:00

i have to fix the header in a gridview and i use this in

  • 0

i have to fix the header in a gridview and i use this in style Class

<style type="text/css">
 .gridFixedHeader
{
background-color:white;
position:relative;
top:expression(GridView1.offsetParent.scrollTop-2);
}
</style>

but i get an error that expression(GridView1.offsetParent.scrollTop-2);is not valid…
what all do i need to do to make this work…..

any suggestions

Main aim… to fix the headers so they dont move when the gridview is scrolled up or down…

any help will be appreciated…

here is my gridview code

<asp:Panel ID="Panel1" runat="server" Height="100px" ScrollBars="Vertical">

 <asp:GridView ID="GridView1" runat="server" AllowSorting="True" 
        AutoGenerateColumns="False" BackColor="White" BorderColor="#CCCCCC" 
        BorderStyle="None" BorderWidth="1px" CellPadding="3"  
        DataKeyNames="MachineGroupID" DataSourceID="SqlDataSource1">
        <RowStyle ForeColor="#000066" />
        <HeaderStyle CssClass="gridFixedHeader" />
        <Columns>
            <asp:BoundField DataField="MachineGroupID" HeaderText="MachineGroupID" 
                InsertVisible="False" ReadOnly="True" SortExpression="MachineGroupID" />
            <asp:BoundField DataField="MachineGroupName" HeaderText="MachineGroupName" 
                SortExpression="MachineGroupName" />
                        </Columns>
        <FooterStyle BackColor="White" ForeColor="#000066" />
        <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
        <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
    </asp:GridView>
    </asp:Panel>

so here i have a gridview where when i scroll the header row moves too.. i dont want that to happen..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T23:17:50+00:00Added an answer on May 13, 2026 at 11:17 pm

    It is not valid in W3C. It is an IE only thing. To do what you are looking for in a valid way would require you to run some JavaScript and fix your headers.

    If you explain your desired outcome I am sure someone can help. I have made GridView headers look exactly like I want many times.

    UPDATE: Here is a good article: http://www.dotnetcurry.com/ShowArticle.aspx?ID=255

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this snippet of the code in my header : class A {
I have a header row which has this structure: <th... <a... <span... {text} If
I have code like <?php header('Content-Type: text/plain; charset=UTF-8'); echo 'Hello Loréane !'; the e
I have a syntax error that I don't know how to fix. This is
i have a small problem here which i cannot fix,This post goes through but
I have this in a header: double commonFunction( ... ) { /*...*/ } namespace
I'm trying to have a full screen UI with a fix header ( a
I have a container div with a fix height defined. This div contains two
I have this page layout: <header> <content> <footer> I have border-left and right applied
I have a CSS layout that simulates a fixed-frame page, with a header and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.