We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How to freeze columns?

Hello, I have one question - how can I implement freezing of column(columns) in DataGrid - .NET . I want to imitate behaviour of freezing columns in for example Access, could you can help me. Greetings. FreeStyle557

2 Replies

JO john May 12, 2004 12:25 PM UTC

If you mean not allowing the user to resize columns, see the message in the forum from a few days ago. Here's a link: http://www.syncfusion.com/forums/message.asp?MessageID=6380

TH thomas June 3, 2004 10:45 AM UTC

i felt your pain. as an alternate solution: Use 2 datagrids. one on the left which shows only the freeze columns. you will need to (for both) inherit from datagrid so you can override the protected GridVScroll event handler. In the event, call the base event, and then post the ScrollEventArgs via an event. Have the freezing grid register for those events. in that event handler, call it''s base.GridVScroll event, passing the original ScrollEventArgs as the second argument. Be sure to set the datasource of the frozen grid to the one on the right''s datasource (that way, tabbing around will also maintain row context. it''s really easy to implement once you get it down, and although not beautiful, it''s functional. ===example from the scroll thrower===== base.GridVScrolled(sender, se); if(null != SrollingGridVScroll) { SrollingGridVScroll(sender, se); } ======example from the scroll catcher(frozen)== public virtual void VerticalScroll(object sender, ScrollEventArgs se) { base.GridVScrolled(sender, se); } //register VerticalScroll to handle the thrower''s VScroll event. gooood luck.
Live Chat Icon For mobile
Up arrow icon