DynamicFilterRepeater show no result in paged GridView with page > 1

Apr 9, 2009 at 12:14 PM
Hi again.
I have another issue with the Dynamic filter.
I'm using DynamicFilterRepeater in a DynamicData web site solution and it works great... but only if I use the filter in page 1!
If I page the gridview into any other page and then I try to filter, it returns no result! the same filter applied in page 1 return the correct data.
It's only me having this behaviour? I'm working with the latest source code available, not with the released version, 'cause I need the UIHint support.
Please help!!!
Apr 9, 2009 at 2:37 PM
Edited Apr 9, 2009 at 2:38 PM
wait, I figured out the problem (but not the solution :-\)
Let's say that you have a gridview with 5 pages of data.
With a given filter, the amount of data only fills 2 pages.
If I start from the unfiltered gridview, go to page 3 and than apply the filter, I'll see an empty gridview. That's because the gridview try to keep the pagination value, ie it try to open page 3... but the data filtered aren't enought to fill 3 pages! So the gridview virtually stay on the 3rd page that is empty.
The solution is to set the page number to 1 everytime you change the filter.
Is there an "elegant" way to accomplish this? Is there some property I could set on the DynamicFilterRepeater ?

thanks in advance
Apr 10, 2009 at 11:05 AM
Edited Apr 10, 2009 at 11:05 AM
Just solved the issue in a quite simple way.
I modify the linkbutton of the search command in this way, simply adding an onClick event pointing on a code behind method
asp:LinkButton ID="LinkButton1" runat="server" Text="Filtra" OnClick="resetPager" CommandName="Search" />

then in code behind I just coded the following method

Sub resetPager(ByVal sender As Object, ByVal e As System.EventArgs)
    GridView1.PageIndex = 0
End Sub

and that's it!

This is a simple workaround for the problem found, anyway maybe the DynamicFilterRepeater needs a new attribute to accomplish this without workaround... 'cause the behaviour I found seems to be a bug...