title: DataGrid fixed table header Asp.Net
body: <p>I have a <code>DataGrid</code> im my aspx Code, which i want to become a fixed header. The problem with <code>DataGrid</code> is that the <code>table</code>which is processed wont have a <code>thead</code> 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.</p>
  
  <pre><code>    &lt;div runat="server" id="divdg1" class="DataGridDIV" style="position:absolute; top:110px; overflow:scroll;"&gt;
          &lt;asp:DataGrid ID="dg1" runat="server" Width="100%" oneditcommand="dg1_EditCommand"
              AutoGenerateColumns="False" CellPadding="5" HorizontalAlign="Center" onitemdatabound="dg1_ItemDataBound" BorderWidth="0px"&gt;
              &lt;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"&gt;&lt;/HeaderStyle&gt;
              &lt;Columns&gt;
                  &lt;asp:BoundColumn HeaderText="Field1" DataField="F1"  &gt;&lt;/asp:BoundColumn&gt;
                  &lt;asp:BoundColumn HeaderText="Field2" DataField="F2"&gt;&lt;/asp:BoundColumn&gt;
                  &lt;asp:BoundColumn HeaderText="Field3" DataField="F3"&gt;&lt;/asp:BoundColumn&gt;
                  ...
              &lt;/Columns&gt; 
          &lt;/asp:DataGrid&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p>It seems there is no way to get this working. I think DataGrid cant get forced into a fixed table header.</p>
  
  <p><strong>EDIT 1:</strong> 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 <a href="http://salzerdesign.com/test/fixedTable.html" rel="nofollow">this</a> to my <code>DataGrid</code>.</p>