GridSerializer class

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

System.Object
  Microsoft.SharePoint.JSGrid.GridSerializer

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

public class GridSerializer : IJsonSerializable

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

  }

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.

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: