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

Change column order in gridlist

I am using a pair of Syncfusion GridListControls matched with their own Syncfusion ComboBoxBase. They are both based on the same data table. Users can choose by name in one and item number in the other. I''d like name to be first column in one and the number the first column in the other. I also want to see the number in the second column after the name and the name in the second column after the number. So hiding columns won''t solve the requirement. Is there a way to change the order or mapping of the columns in a GridListControl without using separate queries? Thanks!

5 Replies

AD Administrator Syncfusion Team February 20, 2004 08:59 PM UTC

You would have to handle the embedded gridcontrol''s QueryCellInfo on one of your gridlistcontrols to swap the column order. Here is a sample. forum11035_1080.zip

GS Greg Shomette February 23, 2004 02:16 PM UTC

Thanks for your response. This doesn''t work in our case because both of our GridListControls have the same ValueMember. We hide that column from view. We also want the two to be connected so that when one is changed the other changes to the same record. That works now because they are both bound to the same datatable. But the order of the columns is the same in both lists. Is there a way to change the order of the columns without changing the ValueMember? Thank-you.

AD Administrator Syncfusion Team February 23, 2004 02:53 PM UTC

Using QueryCellInfo to reorder columns in a GridListControl does not rely on any particular id column. Here is the sample modified to have an hidden id column plus 2 extra columns with the the two dropdowns showing only the 2 extra columns swapped. If you want both comoboxes to remain in sync (change in one, changes the other), then you have to make sure the two gridlistcontrols use the same bindingcontext. forum11035_9003.zip

GS Greg Shomette February 23, 2004 07:32 PM UTC

Thanks, Clay. I should have picked that up from the first example. I''m still having problems, though. I''m using VB.Net and maybe I''m not translating it properly from C#. I am using a gridlistcontrol as you do in your example, but I can''t find a querycellinfo event or property. We are using version 2 Thanks.

AD Administrator Syncfusion Team February 23, 2004 08:11 PM UTC

QueryCellInfo is an event in GridListControl.Grid (not in GridListControl). Here is a VB project. forum11035_VB_46.zip

Live Chat Icon For mobile
Up arrow icon