Column freeze in GridView

我只是一个虾纸丫 提交于 2019-12-24 09:05:36

问题


I have a asp .net web application where I use GridView. There is whole lot of data in it, making it to scroll horizontal as well as vertical. Now, I wanted to freeze the first column in it while horizontal scroll is happening. I got some help from the forums online and wrote this particular piece of css style:

td.locked, th.locked
{
    position: relative;
    top: expression(this.offsetParent.scrollTop);
    background-color: White;        
}

and in the code behind I have this in my grid's RowDataBound event:

e.Row.Cells[0].CssClass = "locked";

But now, freezing of the columns happens in a and if say I have 15 records and my div shows only 10 records and rest has to go for vertical scroll, but the frozen column's 15 rows are overflowing the grid. Please find the screenshot below:

Please let me know what have I missed out so that I could enable vertical scroll for overflown data.


回答1:


Maybe you can try my solution. It can be fixed header and column in gridview.

GridViewScroll with jQuery




回答2:


have you set height and width for the gridview ? try to set height and width for it and set its wrapper's height and width. hope can help you.



来源:https://stackoverflow.com/questions/14038959/column-freeze-in-gridview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!