Hi,
i try to perform filter operation programmatically. So i created an asp button and attached a server side click event handler. The filter operation should be fired in the event handler:
protected void Filter_Click(object sender, EventArgs e)
{
RadGrid grd = grid;
grid.MasterTableView.FilterExpression = "([Capture] LIKE 'Kind%')"; // Capture is the id and unique name of a GridBoundColumn
GridColumn column = grid.MasterTableView.GetColumnSafe("Capture");
column.CurrentFilterFunction = GridKnownFunction.Contains;
column.CurrentFilterValue = "Kind";
grd.EnableLinqExpressions = false;
GridDataItem item = (grid.MasterTableView.GetItems(GridItemType.Item)[2] as GridDataItem);
item.FireCommandEvent("Filter", new System.Web.UI.Pair("Kind", "Capture")); // exception is being fired at this line
grid.Rebind();
}
This code causes an exception:
An exception of type 'System.NullReferenceException' occurred in Telerik.Web.UI.dll but was not handled in user code
at Telerik.Web.UI.GridColumn.RefreshCurrentFilterValue(GridFilteringItem filteringItem, String functionName)
at Telerik.Web.UI.GridFilterCommandEventArgs.ExecuteCommand(Object source)
at Telerik.Web.UI.RadGrid.OnBubbleEvent(Object source, EventArgs e)
at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
at Telerik.Web.UI.GridItem.OnBubbleEvent(Object source, EventArgs e)
at Lusd.Presentation.LusdApplication.UserControls.Schule.InstitutionsListeControl.Filter_Click(Object sender, EventArgs e) in C:\TFS\ZeGOV\LUSD\Client\development\standard\Presentation\Presentation.LusdApplication\UserControls\Schule\InstitutionsListeControl.ascx.cs:line 429
at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
How can I get it fixed?
Thanks in advance