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

GridDataBoundGrid control

Thread ID:





57453 Mar 5,2007 12:03 PM UTC Mar 6,2007 02:48 AM UTC WinForms 1
Tags: GridControl
Matyas Csaba
Asked On March 5, 2007 12:03 PM UTC

I have a griddataboundgrid control and an attached datasource
I do not want to display every column of the corresponding DataMember (a Datatable object)
How could I define the collection of columns I would like to be displayed?

GroupingGridControl has a TableDescriptor.VisibleColumns collection to do this.

There is any similar for GridDataBoundGrid ?

Administrator [Syncfusion]
Replied On March 6, 2007 02:48 AM UTC

Hi Matyas,

To rearrange columns in grid, you can use the Binder.LayoutColumns(). This method rearranges how the columns should be displayed in the grid.
Please try the code below after the binding the datasource to the grid. This will rearrange the columns as desired.

this.gridDataBoundGrid1.Binder.LayoutColumns(new string[] {"Col2", "Col5", "Col3", "Col1", "Col4"});


You can also move columns in the DataBoundGrid, using the grid.Model.Cols.MoveRange method.
See the code below,

// moves column 1 to 3
this.gridDataBoundGrid1.Model.Cols.MoveRange(1, 3);

//moves column 1 & 2 to 4

Here is a sample demonstrating this. MoveColumns.zip

If you dont want certain columns to displayed, then you can hide them as in the code below.

this.gridDataBoundGrid1.Model.HideCols["colName"] = true;
this.gridDataBoundGrid1.Model.HideCols[colindex] = true;



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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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