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

[Solved] RadGrid filter with edited rows

7 Answers 150 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mat
Top achievements
Rank 1
Mat asked on 14 May 2012, 10:01 AM
Hi,

I have a paged RadGrid databound to a view. I catched the event ItemDataBound, and I translate fields in this method.

My filter works well, but with the non-translated label. How can I do to use the translation in my filter? I want to filter after databinding. Do I need to filter client side or can I do it server-side ?

Thanks in advance

7 Answers, 1 is accepted

Sort by
0
Marin
Telerik team
answered on 17 May 2012, 08:43 AM
Hi,

 In order to filter on the server you need to correctly construct the filter expressions of the grid as shown in this help topic:
http://www.telerik.com/help/aspnet-ajax/grid-operate-with-filter-expression-manually.html 

Greetings,
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.
0
Mat
Top achievements
Rank 1
answered on 21 May 2012, 04:20 PM
Hi,

I think that my problem is not to construct a filter correctly, but is to apply a filter after databinding. Changing the filter properties as shown in your link will be applied when databinding. In my case, after databinding, I translate column values programatically.

Thanks in advance,

Stéphane
0
Marin
Telerik team
answered on 23 May 2012, 04:11 PM
Hello,

 The grid first evaluates the filter expressions and then databinds. If you need to construct filter expressions after databding then you have to rebind the grid again after they are constructed, by calling the Rebind() method.

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.
0
Mat
Top achievements
Rank 1
answered on 05 Apr 2013, 12:21 PM
Hi,

I'm back to this problem :). I couldn't call Rebind because it will call myGrid_NeedDataSource...
0
Marin
Telerik team
answered on 10 Apr 2013, 08:00 AM
Hello,

Can you elaborate more on what type of filtering feature you are trying to achieve. Normally the grid performs filter on the underlying datasource and this is not related the data items of the control, which will allow you set filter expressions before databinding of the control

Greetings,
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.
0
Mat
Top achievements
Rank 1
answered on 12 Apr 2013, 12:05 PM
Hello,

Thank you for your answer.

I'll illustrate my problem. I'm in an ASP.Net application. I registered to the events "NeedDataSource" and "ItemDataBound" of my RadGrid.

In the NeedDataSource, I bind to objects from query into my database, and store them in cache locally. The cached object is shared between my Website's users. One property on the source object is a label (by exemple : labelApple, labelCar, labelButton, ...)

In the ItemDataBound, the item's label property is translated in the user language (by exemple : labelApple->Pomme, labelCar->Voiture, LabelButton->Boutton for user n°1 in french, and labelApple->Apfel, labelCar->Auto, labelButton->Taste for user n°2 in german).

My LabelColumn need filter functionnality, and if I apply "Pomme" filter, it doesn't find any row, because the datasource contains "labelApple".

I think that I need to apply filter after the ItemDataBoud event, but before paging.

Do you understand my problem and my question ?

Thanks in advance, regards.
0
Marin
Telerik team
answered on 17 Apr 2013, 01:44 PM
Hello,

 In case you use the default filtering feature of the grid, enabled by setting AllowFilteringByColumn to true, you can handle the ItemCommand event of the grid and there change the text in the filter textbox. Then in the Page_PreRender event you should set back the original text entered by the user.
I have shown this approach in the attached sample page. There when you enter any value the grid will filter by the hardcoded string "Name4" and the original value will be persisted in the filter textbox.

I hope this helps.

Greetings,
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
Mat
Top achievements
Rank 1
Answers by
Marin
Telerik team
Mat
Top achievements
Rank 1
Share this question
or