martes, 17 de enero de 2012

SharePoint 2010 SPGridView

The SPGridView is similar to the asp GridView.  The SPGridView is derived from the aspGridView and has additional functionality.  The SPGridView does not support the property AutoGenerateColumns, you must specify each SPBoundField.

If you didn’t know, you probably will soon, the SPGridView is not available in Sandboxed solutions.

Example: SPBoundFields such as "BoundField" are used to display datasource columns.

Example: To format a bound column use the property "DataFormatString", e.g. colDate.DateFormatString = "{0:d}";, this will display the short date only from a DateTime type.  If you need more advanced formating such as for a multi choice field, create a new class that derives from BoundField and use it in the SPGridView.

Tip: Don't use DataKeyName on the SPDataGrid, it causes the error "Unable to cast object of type 'System.Int32' to type 'System.String'.".




Más información:

Enable editing inline SPGridView:

Use SharePoint 2010 WebParts with a GridView Control to get SQL Image Data type and other Values:


No hay comentarios:

Publicar un comentario