SpgridView Filtrado y clasificación con DataTable
-
10-12-2019 - |
Pregunta
Necesito una ayuda Filtrado y clasificación SPGRIDVIEVIE SPGRIDVIEW basada en DataTable, desde los artículos que he visto en línea, usan ObjectDataSource, etc., pero tengo la red vinculada directamente a DataTable, ¿hay algún tutorial sobre cómo implementar elFiltrado o la clasificación en este caso?He intentado mucho y ahora trabajando para mí.
gracias
Solución
filtrante
oGrid.AllowFiltering = true;
oGrid.FilterDataFields = "Title"; //tells the SPGridView what columns we want to be able to filter on.
oGrid.FilteredDataSourcePropertyName = "FilterExpression";
oGrid.FilteredDataSourcePropertyFormat = "{1} like '{0}'"; //property provides the format for our filter expression in a SQL-like syntax.
clasificación
oGrid.AllowSorting = true;
oGrid.Sorting += new GridViewSortEventHandler(oGrid_Sorting);
void oGrid_Sorting(object sender, GridViewSortEventArgs e)
{
// Call bind datatable function
BindData();
}
// Also make sure when you are adding the columns you should define SortExpression
BoundField colTitle = new BoundField();
colTitle.DataField = "Title";
colTitle.HeaderText = "Title";
colTitle.SortExpression = "Title";
this.oGrid.Columns.Add(colTitle);
referencias
Filtrado de GridView SP en el punto de acción 2010
SpGridView All - Agrupación, paginación, filtrado, Clasificación