12 Answers, 1 is accepted
In order to implement the desired functionality, I recommend that you follow the Creating template columns programmatically section of the Programmatic creation help topic.
The FilterTemplates of the corresponding columns should be created and assigned dynamically, in the same way as the ItemTemplates and EditTemplates.
I hope this helps.
the Telerik team
I create MyFilteringColumn : GridTemplateColumn.
I create programmatically the column so
var newColumn = new ClientsTypesFilteringColumn();
newColumn.DataType = detail.DataType
newColumn.UniqueName = detail.DataField;
newColumn.HeaderText = detail.Description;
When I bind the data the column are empty (if I use a GridBoundColumn, so var newColumn=new GridBoundColumn, I can see data and I can use standard filter without problem),
Moreover when I'm filtering I got "Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: Cannot create column with the specified type name: MyFilteringColumn"
Can you help me?
Without seeing all of the code it's difficult to tell. Be sure you're setting the DataField property, I didn't see that being set in your code snippet. Also, I wound up using a custom item template (inherting from ITemplate) along with the drop-down filter template. Here's the code:
The drop-down filter header template:
The column template:
And the usage of them when building the grid:
Hope that helps point you in the right direction.
Now I created a very simple example with radgrid created programmatically that use a filter custom column.
When I you try to filter you get always the message: Cannot create column with the specified type name: MyCustomFilteringColumn
I try some solution that I found in some threads, but no success.
Could you pls help me?
How did you resolve your problem? I have the same problem and would greatly appreciate any details you can share!
(did you end up setting enableviewstate=false? Or did you use Matt's example above?)
I'm attempting to set the ItemTemplate and FilterTemplate using custom class that inherits ITemplate, but I get the error message below on any ajax request (not just filtering).
Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled.
Details: Error parsing near '
<!DOCTYPE html PUB'
My column configuration: The following works fine if I comment out the line that sets the FilterTemplate. Anyone have suggestions?
I would suggest you to review the blog post below which elaborates on this error and provide possible solution:
the Telerik team
I'm creating a dynamic column and setting it's "FilterTemplate" using a class that inherits ITemplate, the class is "FilterTemplateForMultiSelectCombo". When I use a RadComboBox in "InstantiateIn" I get the error message on any ajax request that page does, not just from the combobox. If I change this control to something other than combo box, it works fine. Each test I'm only adding the control, nothing else. Please see each example below:
FilterTemplateForMultiSelectCombo with RadComboBox:
FilterTemplateForMultiSelectCombo with LABEL: (Works)
a have created a web user control and added a radgrid control to it. At the radgrid, i want to have a combobox filter column, so i adde int the .ascx file the following line of code:
And i created the filter column like that:
The code for the class "MyCustomFilteringColumn" is placed in the .ascx.cs file of the user control. Everything works fine in visual studio, but i want to add this control to a sharepoint page. When i do so, i get the following error:
Could not load file or assembly 'DixonsSalesPromotionToolWebApp' or one of its dependencies. The system cannot find the file specified.
How can i get it work??
Thanks a lot for your time,
If to accomplish your custom filters you are working with the FilterExpression property, it might me hard to maintain the built-in filters as well. The best way to achieve your goal is to define FilterTemplate for the columns having custom filter and firing the built-in filter commands there. See the below sample:
the Telerik team