Thursday, March 3, 2011

ASP.NET Grid with frozen columns

I need a grid that will allow me to freeze a column (the Ms Excel style). I do not need to freeze rows.

Of course the Asp.net 2.o Gridview does not supports this out of the box.

I am sure someone has had a similar requirement and had a way foward.

Please advise any options available with the Gridview. I am also open to using any third party grids out there, so please provide any indicators too.

I develop web apps in Asp.net 2.0

From stackoverflow
  • I don't know if this is possible with the in-box GridView, but the Infragistics UltraWebGrid does support it. (It's called "fixed columns" in that.) However, IG is very expensive and has a pretty sharp learning curve, so you may be better suited with a different component suite for this. Others here are more familiar with the other offerings.

  • This can be achieved using the css classes for the GridView.

    If you need a IE only solution, you can check the below link. http://home.tampabay.rr.com/bmerkey/examples/locked-column-csv.html

    J Angwenyi : Good one. Actually am looking at IE only solution - for company intranet. up vote for the link
  • Here's a possibility:

    <asp:GridView ID="gvFixed" runat="server" DataSourceID="MyDataSource">
    </asp:GridView>
    <div style="float:left; overflow-x:scroll; width:400px;">
        <asp:GridView ID="gvScrolling" runat="server" DataSourceID="MyDataSource">
         </asp:GridView>
    </div>
    

    Use 2 gridviews bound to the same DataSource. By wrapping the "unfrozen" columns in a div with overflow-x:scroll, the second gridview/table will scroll horizontally with the first gridview appearing to a fixed column(s). This would also work for fixed headers

    J Angwenyi : Interesting...Will try this out as well
  • Could you please send the whole Code..I need to look it after it Plzzz....

  • HectorMac...

    Is there a way to link paging for the two grids??? i have about 400+ records and have paging enabled ...so I need to be able to have the two grids page together

    Thanks..

0 comments:

Post a Comment