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'.".

 

Fuente:

http://blog.sharepointsite.co.uk/

 

Más información:

http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webcontrols.spgridview.aspx

Enable editing inline SPGridView: http://kitmenke.com/blog/2010/02/18/editing-in-sharepoints-spgridview/

Use SharePoint 2010 WebParts with a GridView Control to get SQL Image Data type and other Values: http://fabiangwilliams.wordpress.com/2010/06/30/how-to-use-sharepoint-2010-webparts-with-a-gridview-control-to-get-sql-image-data-type-and-other-values/

http://mysharepointwork.blogspot.com/2010/05/using-spgridview-to-list-data-webpart.html

http://kjellsj.blogspot.com/2012/02/spgridview-multiple-filter-sort-columns.html

 

No hay comentarios:

Publicar un comentario