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

How to get a list of visible columns server-side

3 Answers 207 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Al
Top achievements
Rank 1
Iron
Iron
Iron
Al asked on 12 Oct 2016, 02:51 PM

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)?

3 Answers, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 17 Oct 2016, 08:38 AM
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.
0
Rahul
Top achievements
Rank 1
answered on 11 Aug 2017, 11:28 AM

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

0
Eyup
Telerik team
answered on 16 Aug 2017, 05:28 AM
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.
Tags
Grid
Asked by
Al
Top achievements
Rank 1
Iron
Iron
Iron
Answers by
Konstantin Dikov
Telerik team
Rahul
Top achievements
Rank 1
Eyup
Telerik team
Share this question
or