GridViewDataColumn IsVisible property

3 posts, 0 answers
  1. GOURVEZ JJ
    GOURVEZ JJ avatar
    55 posts
    Member since:
    Dec 2009

    Posted 30 Dec 2011 Link to this post

    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. Rahul
    Rahul avatar
    116 posts
    Member since:
    Feb 2011

    Posted 31 Dec 2011 Link to this post

    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

  3. DevCraft banner
  4. GOURVEZ JJ
    GOURVEZ JJ avatar
    55 posts
    Member since:
    Dec 2009

    Posted 02 Jan 2012 Link to this post

    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)
                            {
     
                            }
                        }
     
                    }
                 
                 
                }
            }

Back to Top