Once, I had a similar requirement to implement gridview with fixed header without css.
By Default, scroll width is 16px and when the gridview has more records scrollbar appears. Then, top header div layout changes and columns won't be aligned. So, Idea is to show a blank column(width 16px) after comments when there is a scroll. If there is no scroll, we need to hide that extra column.
if (ProjectTable.scrollHeight > ProjectTable.clientHeight)
That line checks if the div has any scrollbar when content exceeds a given height. Then, blank column(tdPadding) in the header will be shown. So, that all columns in header as well as gridview will be aligned.
ScriptManager.RegisterStartupScript(Page, typeof(Page), "scroll", "setWidth();", true);
After loading the GridView, you need to hide/show that extra column which accounts for the scrollbar width. Otherwise, you may see mismatch in alignment of headers.