how to make datagrid header static

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Smish
    New Member
    • Jan 2007
    • 51

    how to make datagrid header static

    i am using asp .net datagrid in my web page to display some data and that data is bound to the datagrid at runtime. the number of columns to bind also determined dynamically at runtime.

    the grid contains many rows more than 2000. so when i scroll down to see the bottom rows, the header is not visible as it also scrolls. how can i avoid header static

    help me

    thanks
  • dip_developer
    Recognized Expert Contributor
    • Aug 2006
    • 648

    #2
    Originally posted by Smish
    i am using asp .net datagrid in my web page to display some data and that data is bound to the datagrid at runtime. the number of columns to bind also determined dynamically at runtime.

    the grid contains many rows more than 2000. so when i scroll down to see the bottom rows, the header is not visible as it also scrolls. how can i avoid header static

    help me

    thanks
    there are some ways to do that...one of which is......

    read this


    besides that such a fixed header can be made using a style like this ::

    <style type="text/css">
    <!--
    .DataGridFixedH eader {background-color: white; position:relati ve; top:expression( this.offsetPare nt.scrollTop);}
    -->
    </style>

    The background color is needed to hide the data rows as they scroll under the header row. Make sure that the style is on a single line, the expression might not work when the style definition uses multiple lines.

    Apply the new header style to the DataGrid using the HeaderStyle element:

    Comment

    • Sasi Rekha
      New Member
      • Aug 2007
      • 18

      #3
      Originally posted by Smish
      i am using asp .net datagrid in my web page to display some data and that data is bound to the datagrid at runtime. the number of columns to bind also determined dynamically at runtime.

      the grid contains many rows more than 2000. so when i scroll down to see the bottom rows, the header is not visible as it also scrolls. how can i avoid header static

      help me

      thanks
      you can avoid this by using paging concept.

      Comment

      • Smish
        New Member
        • Jan 2007
        • 51

        #4
        Originally posted by Sasi Rekha
        you can avoid this by using paging concept.
        The client dont want the paging concept so i cant use it.
        any other suggestion would be great.

        Comment

        • Smish
          New Member
          • Jan 2007
          • 51

          #5
          thanx...

          i tried the css method but it is not working.
          And regarding the display of header in html tables.... i cant do that cos that requires seting of headerstyle of datagrid to false so the header vanishes ,due to this my column size reduces to 1 cm..the clumns consist of only numeric values...hence the prob..

          thanx again..

          Comment

          Working...