This is a migrated thread and some comments may be shown as answers.

FireCommandEvent fires NullReferenceException

1 Answer 42 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Yazid
Top achievements
Rank 1
Yazid asked on 15 Aug 2016, 09:54 PM

Hi,

when I try to perform filter operation in a button event handler the FireCommandEvent method causes an exception.

        protected void Filter_Click(object sender, EventArgs e)
        {
            RadGrid grd = grid;
            grid.MasterTableView.FilterExpression = "([Capture] LIKE 'Kind%')";
            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"));
            grid.Rebind();
        }

Here is the 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 solved?

 

Thanks in advance.

1 Answer, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 16 Aug 2016, 12:41 PM
Hello Yazid,

I have replied to your query in the other thread you have submitted and suggest we continue the conversation there.

With that said, please avoid submitting duplicate threads. This way we will be able to keep better track of your support history and provide answers faster.


Regards,
Viktor Tachev
Telerik by Progress
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Tags
Grid
Asked by
Yazid
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Share this question
or