How to get a list of visible columns server-side

4 posts, 0 answers
  1. Al
    Al avatar
    216 posts
    Member since:
    Oct 2006

    Posted 12 Oct 2016 Link to this post

    Hi ,

    How can I find out which columns are visible in a server-side routine (some columns may have been shown/hidden with the header context menu)?

  2. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    2067 posts

    Posted 17 Oct 2016 Link to this post

    Hello Al,

    You can traverse the Columns collection of the grid and check their Display and Visible properties:
    List<GridColumn> columns = new List<GridColumn>();
    foreach (GridColumn column in RadGrid1.MasterTableView.RenderColumns)
    {
        if (column.Display == true && column.Visible)
        {
            columns.Add(column);
        }
    }

    Hope this helps.


    Regards,
    Konstantin Dikov
    Telerik by Progress
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
  3. Rahul
    Rahul avatar
    1 posts
    Member since:
    Aug 2017

    Posted 11 Aug in reply to Konstantin Dikov Link to this post

    Hi

    I have tried by it show all the columns, my scenerio is , user has hidden some columns from column menu. and i need to get the columns which are currently visible

  4. Eyup
    Admin
    Eyup avatar
    3288 posts

    Posted 16 Aug Link to this post

    Hi Rahul,

    You can control the client-side visibility of the columns using their Display property. You can also traverse the get_columns() collection of the MasterTableView client-side object and determine which column is currently hidden or shown using the following method:
    http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/client-side-programming/gridcolumn-object/properties/get_visible()

    Regards,
    Eyup
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top