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.
Syncfusion Feedback

Hiding and Showing columns

Thread ID:

Created:

Updated:

Platform:

Replies:

95428 Jul 7,2010 01:10 PM Jul 17,2010 02:51 AM WPF 1
loading
Tags: GridControl
Mike Mann
Asked On July 7, 2010 01:10 PM

I currently have a GridDataControl bound to a DataTable. I would like to allow the user to hide and show columns of their choosing. How can specify hidden and visible columns of the GridDataControl?

Jeraldes J [Syncfusion]
Replied On July 17, 2010 02:51 AM

Hi Mike,
You can use the following code to add or remove column from the data table through code behind.

Remove Column:

var col = dataGrid.VisibleColumns.Where(d => d.MappingName == "Description").FirstOrDefault();
this.dataGrid.VisibleColumns.Remove(col);
this.dataGrid.Model.InvalidateVisual(true);

Add Column:

dataGrid.VisibleColumns.Add(new GridDataVisibleColumn() { MappingName = "Description" });


Regards,
Jeraldes J

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

;