Hide columns in GridListControl

I have a GridDataboundgrid control, in which one cell has type gridlistcontrol.this GrirListcontrol is bound to a Datatable.this datatable has four columns. but i need to show only two of them in Gridlistcontrol. how can i hide the other columns. now its showing all the columns in Datatable.


1 Reply

SR Sri Rajan Syncfusion Team August 29, 2008 11:42 AM UTC

Hi Leena,

Thank you for your interest in Syncfusion products.

You need to set QueryColWidth event, then set e.Size as 0 and e.Handled as true

to hide a column in GridListControl. Here is the sample code which explains this

task.

this.gridListControl1.Grid.QueryColWidth += new

Syncfusion.Windows.Forms.Grid.GridRowColSizeEventHandler(Grid_QueryColWidth);

void Grid_QueryColWidth(object sender,

Syncfusion.Windows.Forms.Grid.GridRowColSizeEventArgs e)
{
if (e.Index > 2)
{
e.Size = 0;
e.Handled = true;
}
}


Please let me know if this helps.

Best Regards


Loader.
Up arrow icon