Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

GridColumn class

Represents the visual aspect of a column to be displayed in the grid.

Namespace:  Microsoft.SharePoint.JSGrid
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

public class GridColumn : BaseGridColumn

This code snippet demonstrates setting column names, widths, and whether a column can be hidden or sorted.

List<GridColumn> r = new List<GridColumn>();
            
            foreach (DataColumn iterator in table.Columns)
            {
                if (iterator.ColumnName != "Key") 
                {
                    GridColumn col = new GridColumn();
                    //point it at a fieldKey name
                    col.FieldKey = iterator.ColumnName;
                    //give the column header a name
                    col.Name = iterator.ColumnName;
                    //define the column width
                    col.Width = 110;
                    

                    //define column settings
                    if (iterator.ColumnName == "Department")
                    {
                        col.IsHidable = false;
                    }
                    if (iterator.ColumnName == "Yearly Estimate")
                    {
                        col.IsSortable = true;
                    }

                    //add the column
                    r.Add(col);
                }
            }

Refer to PivotedGridColumn.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2015 Microsoft