문제

DataTable을 기반으로하는 SPGridView를 필터링하고 정렬하는 데 도움이 필요합니다. 오브젝트 다트 소스 등을 사용하지만 그리드는 DataTable에 직접 바인딩을 묶었습니다. 구현 방법에 대한 자습서가 있습니다.필터링 또는이 경우 정렬?나는 많은 것을 시도하고 지금 나를 위해 일하고 있습니다.

감사합니다

도움이 되었습니까?

해결책

필터링

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

정렬

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

참고 문헌

SP GridView Share Point 2010에서 필터링 P>

SPGridView ALL - 그룹화, 페이징, 필터링, 정렬

페이지 매김을 갖는 SpGridView 웹 파트 생성, 단계별로 단계별로 SharePoint 사이트에서의 기능을 정렬, 필터링

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 sharepoint.stackexchange
scroll top