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 : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

read out column order and visibility

Thread ID:

Created:

Updated:

Platform:

Replies:

63166 Jun 28,2007 11:16 PM UTC Jun 28,2007 11:40 PM UTC WinForms 1
loading
Tags: GridControl
John
Asked On June 28, 2007 11:16 PM UTC


Hi,

Is there a way to read out the current order that the columns are displayed in the databoundgrid? Is there also a way to see if a particular column is visible or not? Thanks!

haneefm [Syncfusion]
Replied On June 28, 2007 11:40 PM UTC

Hi code1234,

Is there a way to read out the current order that the columns are displayed in the databoundgrid?
>>>>>>>>>>>>>>>>>>>>>>
Yes. You can get the bounded column collection orders by using the Binder.InternalColumn property.

foreach(GridBoundColumn c in gridDataBoundGrid3.Binder.InternalColumns)
{
Console.WriteLine(c.MappingName);
}
Is there also a way to see if a particular column is visible or not?
>>>>>>>>>>>>>>>>>>>>>>
You can try this code.

bool IsColumnVisible = gridDataBoundGrid3.Binder.InternalColumns.Contains("ColumnName");

Rearrange the columns.
>>>>>>>>>>>>>>>>>>>>>
To position the columns in the grid, you can use the Binder.LayoutColumns() method. This method rearranges how the columns should be displayed in the grid. Below is the code snippet.

If columns from datasource are populated as Col1, Col2, Col3, Col4, Col5 then you can modify the order of the columns like...

this.gridDataBoundGrid1.Binder.LayoutColumns(new string[] {"Col1", "Col3", "Col5", "Col2", "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);

Best regards,
Haneef

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

;