I am using the Telerik Grid with a filter template, which I used the following example to create.
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/filtertemplate/defaultcs.aspx
Everything is working great with the filter except for one condition. There are times in my application where I would like a filter to be applied when the page loads. I tried to accomplish this with the following code.
The CurrentFilterValue is set and the filter event is fired, but when the page loads I get an error right after the grid tries to databind which says "There was a problem extracting DataKeyValues from the DataSource. Please ensure that DataKeyNames are specified correctly and all fields specified exist in the DataSource." Is there a way to implement this functionality with filtering?
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/filtertemplate/defaultcs.aspx
Everything is working great with the filter except for one condition. There are times in my application where I would like a filter to be applied when the page loads. I tried to accomplish this with the following code.
| protected override void SetCurrentFilterValueToControl(TableCell cell) |
| { |
| if (!(this.CurrentFilterValue == "")) |
| { |
| RadComboBox rcBox = ((RadComboBox)cell.Controls[0]); |
| rcBox.Items.FindItemByText(this.CurrentFilterValue).Selected = true; |
| if (HttpContext.Current.Session["SelectedClassName"] != null) |
| { |
| HttpContext.Current.Session.Remove("SelectedClassName"); |
| ((GridFilteringItem)(((RadComboBox)rcBox).Parent.Parent)).FireCommandEvent("Filter", new Pair("EqualTo", this.CurrentFilterValue)); |
| } |
| } |
| } |
The CurrentFilterValue is set and the filter event is fired, but when the page loads I get an error right after the grid tries to databind which says "There was a problem extracting DataKeyValues from the DataSource. Please ensure that DataKeyNames are specified correctly and all fields specified exist in the DataSource." Is there a way to implement this functionality with filtering?