Freezing the columns in excel is a implausible utility, when engaged on wider unfold sheets. When that you must evaluate values throughout the columns, freezing shall be very helpful. Freezing header will at all times be useful in case you are working in a big knowledge set
GridView is a greatest management to show a spreadsheet / tabular knowledge. However sadly there isn’t any native help for this freezing performance. To make issues worse, there isn’t any in-built help for even GridView scrolling. We have to write our personal Cascading Model Sheets to manage this.
So there’s a want of alternate options. I wish to share how this may be achieved with Types and CSS with the assistance of ASP.internet Earlier than studying additional, I wish to spotlight some details in regards to the applied sciences I’m going to make use of to get this carried out in ASP.Web. That is working primarily based on consumer settings largely, so there isn’t any assure that it’s going to work on all goal platforms.
On prime of that, since it’s consumer centric, the Doc Kind will impression the performance significantly. Deciding on an improper content material kind will trigger the GridView columns to not be frozen. Altering doc kind to strict will result in undesirable results. So hold it Transactional at all times and it labored to me at all times.
Since there isn’t any in-built help for scrolling, we have to do itusing CSS. Scrolling may be enabled utilizing the next
1) Add a container to the GridView. With this we will get scrolling to the GridView
2) to allow scrolling on this div. Add a method attribute “overflow”
Freeze GridView Header
To freeze header, add a method “place: relative;” to header row. After this the whole header row shall be frozen. The header row won’t transfer when scrolling vertically up and down. Whereas scrolling horizontally (e.g. left to proper), the column header have to maneuver horizontally if the required width is greater than accessible width.
Learn extra right here GridView header freeze. Scroll earlier than freeze