Get GridFilteringItem throws exception

0 Answers 92 Views
Ajax Grid
james
Top achievements
Rank 1
james asked on 22 Feb 2022, 05:19 PM | edited on 22 Feb 2022, 06:10 PM

Hi,

I'm trying to set the filter from code behind. When the code below runs to get the GridFilteringItem, I'm getting an  "Index was out of bounds" exception. Any ideas what's causing this? 

 

  protected void RadGrid1_PreRender(object sender, EventArgs e)
        {
            try
            {
                GridFilteringItem filterItem = RadGrid1.MasterTableView.GetItems(GridItemType.FilteringItem)[0] as GridFilteringItem;

                GridColumn col = RadGrid1.MasterTableView.GetColumn("AssignedTo");
                col.CurrentFilterValue = hfProgAssign.Value;

                filterItem.FireCommandEvent("Filter", new Pair("StartsWith", "AssignedTo"));

 

 

JC

james
Top achievements
Rank 1
commented on 22 Feb 2022, 07:24 PM

I found a resolution--there was a bug populating the dat. Once I fixed this issue the event executed properly.

No answers yet. Maybe you can help?

Tags
Ajax Grid
Asked by
james
Top achievements
Rank 1
Share this question
or