Always display gridview header

There is a requirement, to always display gridview header(that means no need to show the header when the empty data source)

  • this scenario comes when we use scroll to move up and down gridview data

Pls reply


I’m not quite sure what you’re asking here. Are you asking if there’s a way to hide the header when no data is present?

Im using this gridview web application and this scenario comes from when we use the vertical scroll bar. so I need this grid header display always…

Oh. If you look at the generated source, you’ll see that asp:gridview simply generates a <table> element. I’m not sure there’s a way to do what you want. Even if you nest it inside a <div> tag with scrolling enabled, the header will still scroll up. What you might want to look at instead is finding a reasonable row count to display that won’t cause the need to scroll in the first place, and then simply enabled paging on the control.

Interesting find Marc, though it didn’t work at all on IE8. Neither version (normal or bullet resist). Worked fine in FF though.