I have a DataGrid
im my aspx Code, which i want to become a fixed header. The problem with DataGrid
is that the table
which 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
.