Filter on RadGridview not working when passing values to filters C#

1 Answer 40 Views
Filter Grid
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Rakhee asked on 15 Nov 2023, 02:40 PM

Hi

I have an application that had a telerik Rad Grid, with filtering enabled.

The application can be opened via another application, passing filters to the first 2 columns like below. However when passing the filters like this the rows are not reflecting what is in the filter. If I was to manually enter the value in the filter it will work.

 

I have this in my code for ItemDatabound

 protected void rg_CallDetails_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if (!string.IsNullOrEmpty(department))
                {
                    rg_CallDetails.MasterTableView.FilterExpression = "([Department] " + "LIKE " + "\'%" + department + "%\' AND [CallNumber] " + "LIKE " + "\'" + callTypePre + "%\' ) ";
                    GridColumn column = rg_CallDetails.MasterTableView.GetColumnSafe("Department");
                    column.CurrentFilterFunction = GridKnownFunction.Contains;
                    column.CurrentFilterValue = department;


                    //rg_CallDetails.MasterTableView.FilterExpression = "([CallNumber] " + "LIKE " + "\'" + callTypePre + "%\') ";
                    GridColumn columnCallType = rg_CallDetails.MasterTableView.GetColumnSafe("CallNumber");
                    columnCallType.CurrentFilterFunction = GridKnownFunction.Contains;
                    columnCallType.CurrentFilterValue = callTypePre;

                    rg_CallDetails.MasterTableView.Rebind();

                }
            }

        }

But the application errors with stackoverflow exception error on the rebind.

I have tried rg_CallDetails.Rebind()

But also gives the same error.

Any advise please?

Thanks

 

                                       

1 Answer, 1 is accepted

Sort by
0
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
answered on 15 Nov 2023, 03:54 PM
Having this in protected void rg_CallDetails_ItemDataBound was the problem. Moved the code to PreRender and now works correctly.
Tags
Filter Grid
Asked by
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Answers by
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Share this question
or