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
close icon

Hiding GLC Column issue

I'm having an issue hiding a GLC column. I have a GDBG with two GLC's. If I hide a GLC column by it's Mapping Name, it is hiding the same column position on the second GLC. I have an example attached.

GLC_Issue_Project.zip

1 Reply

SA Saravanan A Syncfusion Team May 17, 2007 07:27 PM UTC

Hi JMS,

The embedded grid in the GridListControl will maintain the HiddenColumnEntries based on the column index. So whenever you hide any column with a mapping name, it will find the corresponding column index and make an entry in the HiddenColumnEntries collection. And another fact is that all the GridListControl cells will refer to a same GridListControl object and that GridListControl will get populated just before dropdown window opens. This is the reason for the behavior you have seen.

To over come this, you would have to subscribe to the CurrentCellShowingDropDown event. And in that event handler reset all the hidden column and then selectively hide the columns based on the mapping name.

Please try the following code snippet and let me know if this helps.

void gridDataBoundGrid1_CurrentCellShowingDropDown(object sender, GridCurrentCellShowingDropDownEventArgs e)
{
GridDropDownGridListControlCellRenderer cr = this.gridDataBoundGrid1.CurrentCell.Renderer as GridDropDownGridListControlCellRenderer;

if (cr != null)
{
//Resetting all the hidden columns
int colCount = cr.ListControlPart.Grid.Model.ColCount;
cr.ListControlPart.Grid.Model.HideCols.ResetRange(1, colCount);

GridCurrentCell cc = gridDataBoundGrid1.CurrentCell;
int field = gridDataBoundGrid1.Binder.ColIndexToField(cc.ColIndex);
GridBoundColumn column = gridDataBoundGrid1.Binder.InternalColumns[field];

//Hiding selective columns
if (column.MappingName == "mrh_RecID")
{
cr.ListControlPart.Grid.Model.HideCols["mrh_RecID"] = true;
}
}
}


Best Regards,
Saravanan.

Loader.
Live Chat Icon For mobile
Up arrow icon