Hiding/Unhiding the columns

Hi Clay, I''m using GDBG grid. Here I''m having a CheckBox in my form. When the User Checks the CheckBox I need to Hide some of the selected columns in the Grid and when the User Unchecks the CheckBox I need to Show all the Columns I tried with the follwing code but didn''t work. private void CheckBox1_CheckedChanged(object sender, System.EventArgs e) { try { if(this.CheckBox1.Checked) { for(int i = 1;i<=10;i++) { this.assignDesigGridDataBoundGrid_.Model.Cols.Hidden[i] = true; } } else { for(int i = 1;i<=10;i++) { this.assignDesigGridDataBoundGrid_.Model.Cols.Hidden[i] = false; } } } catch (Exception Ex) { MessageBox.Show(Ex.Message); } }

2 Replies

AD Administrator Syncfusion Team October 4, 2004 10:29 AM UTC

Your code seems to work for me in this sample. (You may want to use a BeginUpdate/EndUpdate to avoid the flickering, but it seems to work as is.) HideColumns_8871.zip In your actual code, do you have an open BeginUpdate that does not have a matching EndUpdate? This could cause things not to redraw.


TH Thiyagu October 4, 2004 12:56 PM UTC

Yeh Clay.. I''ve missed out the EndUpdate.. Thanks Clay. >Your code seems to work for me in this sample. (You may want to use a BeginUpdate/EndUpdate to avoid the flickering, but it seems to work as is.) >HideColumns_8871.zip > >In your actual code, do you have an open BeginUpdate that does not have a matching EndUpdate? This could cause things not to redraw. > >

Loader.
Up arrow icon