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

RadGrid Showing Filter status.

1 Answer 81 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Matt
Top achievements
Rank 1
Matt asked on 07 Mar 2012, 10:14 PM
I have a client requirement to show a status field if a filter is applied to the RadGrid. To get the status I am basically checking to see if the FilterExpression has a .length >0 and then updating a ASP:LITERAL with the value. Here is the code: 

// determin filter status and update UI
bool b = RadGrid1.MasterTableView.FilterExpression.Length > 0;
string status = string.Format("Filtered: {0}", b.ToString(CultureInfo.InvariantCulture));
this.ltrfilterStatus.Text = status;

My question is, what event(s) should I be attaching my code to in order to keep that status current? And, should this code be server-side or client-side (I have versions of both)

I have tried on the Grid.PreRender, which of course fails because it hasn't bound any columns or processed any filters. I have also tried this on pageLoad (client side) and it fails there too.  I have tried ItemBound, ColumnCreated and none seem to provide the proper timing to show the status. I also tried to inject a client-side script on the AjaxRequest of my AjaxManager but the event never seemed to fire. 

Anyone else have any thoughts, or should I just be pushing back to my customer?

Thanks
-Matt

1 Answer, 1 is accepted

Sort by
0
Marin
Telerik team
answered on 12 Mar 2012, 11:10 AM
Hi Matt,

 All the items, columns and FilterExpressions in the grid should be available after the control has been databound. Normally this is done in the Page_PreRender event unless you use some custom approach for databinding or you rebind the control manually.
If the problem still persists I will appreciate if you can specify how you bind the control and possibly share any relevant mark up so we can have a look at it.

Kind regards,
Marin
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Matt
Top achievements
Rank 1
Answers by
Marin
Telerik team
Share this question
or