Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1255
"Select all" function for column chooser
posted

Hello,

I'm implementing "select all" feature for column chooser on the grid.   But the code I wrote is not working.  Here it is :

                  private void Handle_ColumnChooserSelectAll_Click( object sender, EventArgs e )

                  {

                        var visibleColumn       = _columnChooser.ColumnChooserControl.DisplayLayout.Bands[ 0].Columns[ “Visible” ];

 

                        if ( visibleColumn == null )

                        {

                              return;

                        }

 

                        // A precaution

                        if ( _columnChooser.ColumnChooserControl.DisplayLayout.Rows.Count == 0 )

                        {

                              return;

                        }

 

                        // Remember the current row

                        foreach ( var thisRow in _columnChooser.ColumnChooserControl.DisplayLayout.Rows )

                        {

                              // If checked, take no action

                              if ( ( bool )( thisRow.Cells[ visibleColumn.Index ].Value ) )

                              {

                                    continue;

                              }

 

                              thisRow.Cells [ visibleColumn.Index ].Value = true;

                        }

 

                        // Go back to the top; hard to reach the old "current row"

                        _columnChooser.ColumnChooserControl.DisplayLayout.Rows[ 0 ].Activate();

                  }

We use this statement  to make the column selected :   " thisRow.Cells [ visibleColumn.Index ].Value = true;",     But after this statement,   the value is still false !   Can anyone help  ?

  • 469350
    Suggested Answer
    Offline posted

    Hi,

    Not sure why that's not working for you. If you want to post a small sample project demonstrating this, I'd be happy to take a look at it.

    But in the mean time, why don't you simply loop through the actual columns in the grid and set the Hidden property to false on each column? That's basically the same thing, and it should work both for the grid and the ColumnChooser.