Hi there
I am using the Advanced Data Binding on a grid and want to set the initial filter. It is showing the text, but its not limiting the results as expected. If I filter after a page load, it does work though. I have also tried filtering with the PreRender event, but that doesn't work.
Here is my ASPX
and here is the code behind
Any ideas?
Thank you
I am using the Advanced Data Binding on a grid and want to set the initial filter. It is showing the text, but its not limiting the results as expected. If I filter after a page load, it does work though. I have also tried filtering with the PreRender event, but that doesn't work.
Here is my ASPX
<
telerik:RadGrid
ID
=
"uxBookOrderGrid"
runat
=
"server"
AutoGenerateColumns
=
"false"
OnNeedDataSource
=
"uxBookOrderGrid_NeedDataSource"
AllowPaging
=
"true"
PageSize
=
"10"
Width
=
"95%"
AllowFilteringByColumn
=
"true"
EnableLinqExpressions
=
"false"
AllowSorting
=
"true"
>
<
MasterTableView
DataKeyNames
=
"BookOrderID"
>
<
Columns
>
<
telerik:GridBoundColumn
FilterControlWidth
=
"90%"
SortExpression
=
"StatusDescription"
HeaderText
=
"Status"
DataField
=
"StatusDescription"
UniqueName
=
"StatusDescription"
CurrentFilterFunction
=
"Contains"
ShowFilterIcon
=
"false"
AutoPostBackOnFilter
=
"true"
/>
</
Columns
>
<
NoRecordsTemplate
>
No Book Orders waiting to be Approved.
</
NoRecordsTemplate
>
</
MasterTableView
>
</
telerik:RadGrid
>
protected
void
uxBookOrderGrid_NeedDataSource(
object
sender, GridNeedDataSourceEventArgs e)
{
/// <summary>
/// Fill Grid with all Book Orders that needs to be Approved
/// </summary>
uxBookOrderGrid.DataSource = SATextBooksUJ.Data.BookOrder.GetBookOrderListForAcquisition(acquisitions.UserID);
if
(!IsPostBack)
{
uxBookOrderGrid.MasterTableView.FilterExpression =
"([StatusDescription] LIKE=\'%Approved by Departmental Approver%\')"
;
GridColumn statusColumn = uxBookOrderGrid.MasterTableView.GetColumnSafe(
"StatusDescription"
);
statusColumn.CurrentFilterFunction = GridKnownFunction.Contains;
statusColumn.CurrentFilterValue =
"Approved by Departmental Approver"
;
}
}
Thank you