0

I have a DataGrid im my aspx Code, which i want to become a fixed header. The problem with DataGrid is that the tablewhich is processed wont have a thead element. So i cant use some JQuery kung-fu to get this working. There are other ways out there, like the CSS hack one-liner that only works in older IE versions, but that isnt the solution at all.

    <div runat="server" id="divdg1" class="DataGridDIV" style="position:absolute; top:110px; overflow:scroll;">
        <asp:DataGrid ID="dg1" runat="server" Width="100%" oneditcommand="dg1_EditCommand"
            AutoGenerateColumns="False" CellPadding="5" HorizontalAlign="Center" onitemdatabound="dg1_ItemDataBound" BorderWidth="0px">
            <HeaderStyle Font-Bold="True" Wrap="False" HorizontalAlign="Center" 
                            Height="25px" CssClass="ms-formlabel DataGridFixedHeader" Font-Italic="False" 
                            Font-Overline="False" Font-Size="8pt" Font-Strikeout="False" 
                            Font-Underline="False"></HeaderStyle>
            <Columns>
                <asp:BoundColumn HeaderText="Field1" DataField="F1"  ></asp:BoundColumn>
                <asp:BoundColumn HeaderText="Field2" DataField="F2"></asp:BoundColumn>
                <asp:BoundColumn HeaderText="Field3" DataField="F3"></asp:BoundColumn>
                ...
            </Columns> 
        </asp:DataGrid>
    </div>

It seems there is no way to get this working. I think DataGrid cant get forced into a fixed table header.

EDIT 1: There are some ways to get this done. Sadly, its a hack n' slash that only works by 60% at the time by now. After that, never touch the file again. Just if somebody else bumps into this, i kinda applied this to my DataGrid.

DanielK
  • 424
  • 6
  • 17

1 Answers1

0

it has already asked on stackoverflow. please go through the link

Freeze the Header, Scroll the GridView

Community
  • 1
  • 1
Indranil.Bharambe
  • 1,462
  • 3
  • 14
  • 25
  • The solutions presented there work only for the IE. Not for other browsers. I allready spent quite a lot of time in testing and researching but didnt come up with a good idea. – DanielK Nov 28 '13 at 10:38
  • please go through http://www.codeproject.com/Articles/8787/The-Freeze-Pane-DataGrid , http://www.codeproject.com/Articles/11636/ScrollingGrid-A-cross-browser-freeze-header-two-wa – Indranil.Bharambe Nov 28 '13 at 10:43
  • No Support for new Browsers. The external Control didnt work, neither the CSS lock from the first link. – DanielK Nov 28 '13 at 13:22