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.
Unfortunately, activation email could not send to your email. Please try again.

GridDataBoundGrid control

Thread ID:

Created:

Updated:

Platform:

Replies:

57453 Mar 5,2007 07:03 AM Mar 5,2007 09:48 PM Windows Forms 1
loading
Tags: GridControl
Matyas Csaba
Asked On March 5, 2007 07:03 AM

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 5, 2007 09:48 PM

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"});


--OR---

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
this.gridDataBoundGrid1.Model.Cols.MoveRange(1,2,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;
//or
this.gridDataBoundGrid1.Model.HideCols[colindex] = true;

Thankyou,
S.Shyam.

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.

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.

;