I'm having a bit of difficulty figuring out how to implement a custom filter for the grid. I'm using advanced data binding and my filtering parameters are implemented by separate HTML controls not part of RadGrid. Essentially what I want to do is define the FilterExpression value client-side and make sure that it's being passed and available each time server-side during _NeedDataSource.
If I do something like this client-side:
var grid = $find("MessageGrid");
var MasterTable = grid.get_masterTableView();
MasterTable.filter("LogTime", 10254, Telerik.Web.UI.GridFilterFunction.GreaterThan, true);
during _NeedDataSource, MessageGrid.MasterTableView.FilterExpression is empty.
In general, how do I set a parameter value on the grid such that it is persisted in the View State so that it is also available, for example, during Paging, when _NeedDataSource will be called automatically?
Here's my client-side definition of the grid. I'm binding the columns server-side during Page_Init:
| <telerik:RadGrid ID="MessageGrid" runat="server" ShowStatusBar="true" EnableViewState="false" AllowSorting="true" AllowMultiRowSelection="true" AllowCustomPaging="true" AllowPaging="True" AutoGenerateColumns="False" GridLines="None" OnPageSizeChanged="MessageGrid_PageSizeChanged" OnNeedDataSource="MessageGrid_NeedDataSource" > |
| <MasterTableView ClientDataKeyNames="Id, ReferenceId"> |
| </MasterTableView> |
| <ClientSettings AllowColumnsReorder="true" ReorderColumnsOnClient="true"> |
| <Resizing AllowColumnResize="true" /> |
| <Scrolling AllowScroll="true" UseStaticHeaders="true" /> |
| <ClientEvents OnRowSelected="MessageGrid_OnRowSelected" OnRowDblClick="MessageGrid_OnDblClick" OnGridCreated="MessaegGrid_Created" /> |
| <Selecting AllowRowSelect="True" /> |
| </ClientSettings> |
| </telerik:RadGrid> |
| <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest"> |
| <AjaxSettings> |
| <telerik:AjaxSetting AjaxControlID="MessageGrid"> |
| <UpdatedControls> |
| <telerik:AjaxUpdatedControl ControlID="MessageGrid" /> |
| </UpdatedControls> |
| </telerik:AjaxSetting> |
| </AjaxSettings> |
| </telerik:RadAjaxManager> |
