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. Image for the cookie policy date

Hiding empty columns with grid grouping control

I have a number of empty columns with my syncfusion grid grouping control.  After I load the grid, I would like to be able to loop through the grid, determine which columns are empty and then remove the from the visible columns list.  Is this possible to do with the grid grouping control?

3 Replies

PP Praveena P Syncfusion Team December 11, 2013 05:34 AM UTC

Hi Alexander,

Thank you for your interest in Syncfusion products.

To loop through the GridGroupingControl columns make use of visiblecolumndescriptor collection and check the condition whether columns are empty in the loop.

 Please refer the below code:

foreach (GridVisibleColumnDescriptor visibleColumnDescriptor in gridGroupingControl1.TableDescriptor.VisibleColumns)
{
//condition for empty columns
}

To remove column from the visible columns list kindly make use of below code:

this.gridGroupingControl1.TableDescriptor.VisibleColumns.Remove("Col1");

Regards,

Praveena.



AG Alexander Glass December 11, 2013 10:20 PM UTC

I'm trying to create a generic method for testing if all values in data[i, col] == null.  Can you help me understand how to access columns and the data stored in the column using row/column indices?


PP Praveena P Syncfusion Team December 16, 2013 03:45 AM UTC

Hi Alexander,

Thanks for your update.

 To access data stored in the column, kindly make use of  the TableModel which support for retreiving data from datasource .Using cellvalue property you can get the data of the specific cell.

 Code:

if (gridGroupingControl1.TableModel[1, 2].CellValue == "")

{

}

Please let me know if you have any concerns.

Regards,

Praveena.


Loader.
Live Chat Icon For mobile
Up arrow icon