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

Custom Paging w/ custom filter

1 Answer 132 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Justin Heath
Top achievements
Rank 2
Justin Heath asked on 22 May 2009, 03:32 PM
I have a grid where I am using a stored proc in NeedsDataSource to populate the grid - the stored proc has support for custom paging, sorting and filtering. 

The paging and sorting appear to work perfectly on their own, however, when combined with filtering I have an issue.  The initial filter works as expected by hooking into the ItemCommand event:

Protected Sub rgPromos_ItemCommand(ByVal source As ObjectByVal e As GridCommandEventArgs) Handles rgPromos.ItemCommand 
        If e.CommandName = RadGrid.FilterCommandName Then 
            Dim filterPair As Pair = CType(e.CommandArgument, Pair) 
            Dim colName As String = filterPair.Second.ToString() 
 
            If colName = "PromotionCode" Then 
                Dim tbPattern As TextBox = CType((CType(e.Item, GridFilteringItem))(colName).Controls(0), TextBox) 
                PromoCodeFilter = tbPattern.Text 
                PromoCodeFilterOperator = filterPair.First.ToString() 
                rgPromos.Rebind() 
            End If 
End Sub 

PromoCodeFilter and PromoCodeFilterOperator are properties I use to store the information from the filter - I then pass these values into my stored proc and everything is right in the world.  

The problem is after that initial filter, if I change the grid page the filter values aren't properly passed into the stored procedure.  I assume that on the paging event or something I need to check to see if any filters had already been applied.  Can anyone point me in the right direction? 

1 Answer, 1 is accepted

Sort by
0
Justin Heath
Top achievements
Rank 2
answered on 22 May 2009, 05:34 PM
Okay, this was pretty simple to fix by just storing the data in viewstate rather than in page variables - hope this helps someone else in the future!
Tags
Grid
Asked by
Justin Heath
Top achievements
Rank 2
Answers by
Justin Heath
Top achievements
Rank 2
Share this question
or