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

Hiding and Showing columns

Thread ID:

Created:

Updated:

Platform:

Replies:

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

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 06:51 AM UTC

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.

Please sign in to access our forum

or the page will be automatically redirected to 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

;