GridSerializer Class

Serializes configuration information and data for the Microsoft.SharePoint.JSGrid into a JavaScript Object Notation (JSON) string.

Inheritance Hierarchy

System.Object
  Microsoft.SharePoint.JSGrid.GridSerializer

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

Syntax

'Declaration
Public Class GridSerializer _
    Implements IJsonSerializable
'Usage
Dim instance As GridSerializer
public class GridSerializer : IJsonSerializable

Remarks

This snippet demonstrates how to create a grid serializer.

protected void Page_Load(object sender, EventArgs e)
  {
// Build some simple data for the grid to display.
DataTable data = new GridData().Data(20);

// Create a grid serializer to connect to data.
GridSerializer gds = new GridSerializer(SerializeMode.Full,
    data, "Key", new FieldOrderCollection(new String[] { "Department" }),
    GridUtilities.GetGridFields(data), GridUtilities.GetGridColumns(data));

// Point the grid serializer at the grid serializer data
_grid.GridDataSerializer = gds;

// Tell the grid to listen to the GridManager controller.
_grid.JSControllerClassName = "GridManager";
gds.EnableHierarchy(null, "HierarchyParentKey", "Tasks", false);
// Enable the Gantt chart.
gds.EnableGantt(DateTime.Now.AddDays(0), DateTime.Now.AddDays(10), GanttUtilities.GetStyleInfo(), null);

  }
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
'Build some simple data for the grid to display.
Dim data As DataTable = New GridData().Data(20)

'Create a grid serializer to connect to data.
Dim gds As New GridSerializer(SerializeMode.Full, data, "Key", New FieldOrderCollection(New String() { "Department" }), GridUtilities.GetGridFields(data), GridUtilities.GetGridColumns(data))

'Point the grid serializer at the grid serializer data.
_grid.GridDataSerializer = gds

'Tell the grid to listen to the GridManager controller.
_grid.JSControllerClassName = "GridManager"

gds.EnableHierarchy(Nothing, "HierarchyParentKey", "Tasks", False)
'Enable the gantt chart.
gds.EnableGantt(Date.Now.AddDays(0), Date.Now.AddDays(10), GanttUtilities.GetStyleInfo(), Nothing)

End Sub

For a complete example that demonstrates using the grid serializer to create a JS Grid control, including the definitions of the field and column data, see How to: Create a Basic JS Grid Control.

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

GridSerializer Members

Microsoft.SharePoint.JSGrid Namespace