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 Object, ByVal 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?