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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Change the Col position

Thread ID:

Created:

Updated:

Platform:

Replies:

44503 May 25,2006 10:50 AM UTC May 30,2006 10:04 AM UTC WinForms 12
loading
Tags: GridControl
Ravichandran
Asked On May 25, 2006 10:50 AM UTC

HI I am using the Grid control. The requriment is the user can change the position of col during runtime. How do I change the position during runtime? Can we have any property to set so that the col will be displayed in that position. Want to move the col right or left..user can palyaround in positioning the column. Pls let me knw ASAP... Cheers Ravi

Administrator [Syncfusion]
Replied On May 25, 2006 11:24 AM UTC

Hi Ravi, To rearrange the columns of the grid, you need to use the Binder.LayoutColumns(). The LayoutColumns() rearranges how the columns should be displayed in the grid and allows you to specify covered cells and / or break records into several rows displayed in the grid. Here is some code snippet this.gridDataBoundGrid1.Binder.LayoutColumns( "Id","Points","Name"); Here is a sample. http://www.syncfusion.com/Support/user/uploads/contextMenu_fb5f7280.zip Please let me know if this helps. Best Regards, Haneef Please note : "-" indicates a covered cell, "." indicates a new row, "" specifies an empty "whitespace" column.

Administrator [Syncfusion]
Replied On May 25, 2006 11:29 AM UTC

Hi Ravi, Set the gridControl1.ControllerOptions |= GridControllerOptions.DragColumnHeader; or the gridControl1.AllowDragSelectedCols = true; to enable moving columns by click and drag at run time. Regards, Calvin.

Administrator [Syncfusion]
Replied On May 25, 2006 11:39 AM UTC

Hi Ravi, To move the cols through code the Model.Cols.MoveRange method can be used. grid.Model.Cols.MoveRange(from,count,target); //to move more than one col grid.Model.Cols.MoveRange(from,target); Regards, Calvin.

Ravichandran
Replied On May 25, 2006 11:45 AM UTC

Hi First thing,I am not using bound grid control I am using GridControl only. Secondaly, I dont want to use mouse options or drag and drop columns. Idea is,we are going to provide an user interface (GUI) to list all the cols user can change the position and also remove (hide) the cols they dont want to see..etc. So once they click ok...the corresponding grid has to be refreshed with these changes ( hide or moving the position etc)... So once clikc OK i have to change the cols collection position. Let me kwno Cheers Ravi >Hi Ravi, > >Set the gridControl1.ControllerOptions |= GridControllerOptions.DragColumnHeader; or the gridControl1.AllowDragSelectedCols = true; to enable moving columns by click and drag at run time. > >Regards, >Calvin.

Administrator [Syncfusion]
Replied On May 25, 2006 01:50 PM UTC

Hi Ravi, The Cols.RemoveRange method can be used to remove the cols and the Cols.Hidden[colIndex] can be set to true to hide the column. Attached is a sample that demonstrates customizing the gridControl’s columns at runtime through a GUI. Regards, Calvin.

CustomizeCols.zip

Ravichandran
Replied On May 25, 2006 02:53 PM UTC

Hi Calvin Thanks. This is what I exactly want. I am going to use implement the same with my application and let you know if I need any help. Cheers Ravi >Hi Ravi, > >The Cols.RemoveRange method can be used to remove the cols and the Cols.Hidden[colIndex] can be set to true to hide the column. Attached is a sample that demonstrates customizing the gridControl’s columns at runtime through a GUI. > >Regards, >Calvin.

CustomizeCols.zip

Ravichandran
Replied On May 25, 2006 02:54 PM UTC

Before that... If I move the cols do we need to bind the datasource again? Ravi >Hi Calvin > >Thanks. This is what I exactly want. I am going to use implement the same with my application and let you know if I need any help. > >Cheers >Ravi > >>Hi Ravi, >> >>The Cols.RemoveRange method can be used to remove the cols and the Cols.Hidden[colIndex] can be set to true to hide the column. Attached is a sample that demonstrates customizing the gridControl’s columns at runtime through a GUI. >> >>Regards, >>Calvin.

CustomizeCols.zip

Ravichandran
Replied On May 25, 2006 04:01 PM UTC

Hi I have tried your code solution in my application. But the column header is moving but no the data. Ravi >Before that... >If I move the cols do we need to bind the datasource again? > >Ravi > >>Hi Calvin >> >>Thanks. This is what I exactly want. I am going to use implement the same with my application and let you know if I need any help. >> >>Cheers >>Ravi >> >>>Hi Ravi, >>> >>>The Cols.RemoveRange method can be used to remove the cols and the Cols.Hidden[colIndex] can be set to true to hide the column. Attached is a sample that demonstrates customizing the gridControl’s columns at runtime through a GUI. >>> >>>Regards, >>>Calvin.

CustomizeCols.zip

Administrator [Syncfusion]
Replied On May 26, 2006 04:29 AM UTC

Hi Ravi, If you are populating the grid through virtual mode then please refer to the below forum thread to know about re-order the columns with a help of a column indexer array. http://www.syncfusion.com/Support/forums/message.aspx?MessageID=43184 And if you are using the PopulateValues method then first populate the grid by calling the PopulateValues method and then customize the columns. Regards, Calvin.

Ravichandran
Replied On May 26, 2006 09:11 AM UTC

Hi But I dont want to drag and drop method. As I said earlier its based on user preference only. I am using Virtual grid only... Cheers Ravi >Hi Ravi, > >If you are populating the grid through virtual mode then please refer to the below forum thread to know about re-order the columns with a help of a column indexer array. > >http://www.syncfusion.com/Support/forums/message.aspx?MessageID=43184 > >And if you are using the PopulateValues method then first populate the grid by calling the PopulateValues method and then customize the columns. > >Regards, >Calvin.

Administrator [Syncfusion]
Replied On May 29, 2006 04:05 AM UTC

Hi Ravi, Attached is the extended sample that demonstrates how to re-order the columns of a virtual grid with a help of a column indexer array. Here is a sample. http://www.syncfusion.com/Support/user/uploads/CustomizeCols_32ea3d59.zip Regards, Calvin.

Ravichandran
Replied On May 30, 2006 10:04 AM UTC

Hi Thanks. Let you know if i need any help. Cheers Ravi >Hi Ravi, > >Attached is the extended sample that demonstrates how to re-order the columns of a virtual grid with a help of a column indexer array. > >Here is a sample. >http://www.syncfusion.com/Support/user/uploads/CustomizeCols_32ea3d59.zip > >Regards, >Calvin. >

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;