GridColumn Class

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

Inheritance Hierarchy

System.Object
  Microsoft.SharePoint.JSGrid.BaseGridColumn
    Microsoft.SharePoint.JSGrid.GridColumn

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

Syntax

'Declaration
Public Class GridColumn _
    Inherits BaseGridColumn
'Usage
Dim instance As GridColumn
public class GridColumn : BaseGridColumn

Remarks

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.

Thread Safety

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

See Also

Reference

GridColumn Members

Microsoft.SharePoint.JSGrid Namespace