This is a migrated thread and some comments may be shown as answers.

GridViewDataColumn IsVisible property

2 Answers 48 Views
GridView
This is a migrated thread and some comments may be shown as answers.
GOURVEZ JJ
Top achievements
Rank 1
GOURVEZ JJ asked on 30 Dec 2011, 03:47 PM
Hello,

I want use 3 GridViewDataColumn in an RadGridView.
My users must have right to see each DataColumn.

I want use IsVisibleProperty with an databinding.
But when I put an value in databinding, the IsVisibleProperty not aply the update.

Can you help me ?

Thanks

2 Answers, 1 is accepted

Sort by
0
Rahul
Top achievements
Rank 2
answered on 31 Dec 2011, 05:48 PM
Hi GOURVEZ JJ
 
        I think you can't bind IsVisible property through binding.
However you can resolve your issue by accessing that column
in Grid RowLoaded Event. There you can handle all properties
of Grid column.

Regards
Rahul

0
GOURVEZ JJ
Top achievements
Rank 1
answered on 02 Jan 2012, 01:40 PM
Thanks for your answer.

I tried this solution, it's ok but I have performance problems.

In the rowLoaded event, I display column, but if  I have 5000 rows, it's slow.


This is my code :
private void chargementLigneRadGridView2(object sender, RowLoadedEventArgs e)
        {
            selectClass select = (selectClass)e.DataElement;
            if (select != null)
            {
                var row = e.Row as GridViewRow;
 
 
                if (row != null)
                {
 
                    string[] reucp = select.listeAffichageColonne.Split(';');
 
                    foreach (string rec in reucp)
                    {
                        try
                        {
                            int valeur = int.Parse(rec);
                            e.GridViewDataControl.Columns[valeur].IsVisible = true;
 
 
                        }
                        catch (Exception ex)
                        {
 
                        }
                    }
 
                }
             
             
            }
        }

Tags
GridView
Asked by
GOURVEZ JJ
Top achievements
Rank 1
Answers by
Rahul
Top achievements
Rank 2
GOURVEZ JJ
Top achievements
Rank 1
Share this question
or