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
close icon

Dragging Columns on a Data Bound Grid

I''m sure I''ve been able to reorder columns on a GridDataBoundGrid by dragging and dropping. Playing with the "DataBoundSortByDisplayMember" sample I cannot get this to work. Is it supported? What do I need to change in the sample to get this to work? With GridGroupingControl is just works. I''m using SyncFusion 2.1.0.9. Thanks, Ben.

1 Reply

AD Administrator Syncfusion Team August 19, 2004 10:47 AM UTC

That sample turned off column moving so a single click could sort the column instead of selecting it for moving. To turn it back on, you simply do step 5 below. But this may look strange to you as it sorts and selects for moving at the same time. One work around would be to use a double click to sort. But this requires more than just setting the SortBehavior property in the sample since the sample uses events to change the default sort behavior. Below are the steps I took to make that sample sort on a double click and select for moving on a single click. 1) In gridDataBoundGrid1_CellClick, set bool VersionGreater1618 = true; 2) COmment out the OnCellClick override in the derived class, DataBoundGrid. (Or don''t use it). 3) Instead of subscribing to grid.CellClick, subscribe to grid.CellDoubleClick to sort on a double click. You can use the exact same handler, gridDataBoundGrid1_CellClick, as the CellClick used (with the change from #1). 4) change grid.SortBehavior property to none (instead of double click). This is in two places. 5) Add the GridSelectionFlags.Column flag to the this.gridDataBoundGrid1.AllowSelection property.

Loader.
Live Chat Icon For mobile
Up arrow icon