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

Dynamic RedGrid FilterTemplate

3 Answers 106 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Alic W
Top achievements
Rank 1
Alic W asked on 02 Aug 2009, 02:31 AM
Hi,

I am trying to create my own filter template for a certain column in RadGrid dynamically. I tried to do this on Load/Render/init, still to no avail.

myColumn.FilterTemplate = new CustomGridTemplate();

...
public class CustomGridTemplate: ITemplate
    {
        public CustomGridTemplate()
        {
        }

        public void InstantiateIn(System.Web.UI.Control container)
        {
            TextBox tbx = new TextBox();
            tbx.Text = "Test";
            container.Controls.Add(tbx);
        }
   }

The grid filter shows up with the standard controls for that column - the breakpoint in CustomGridTemplate class constructor doesn't even get hit. I've seen an example for regular templated columns, but I am using AutoGeneratedColumns. I would appreciate your comments.

3 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 03 Aug 2009, 01:29 PM
Hi Alic,

I am sending you a simple runnable project which handles the desired functionality. Please give it a try and let me know if you need additional assistance.

Sincerely yours,
Pavlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Raji
Top achievements
Rank 1
answered on 14 Nov 2011, 07:53 PM
Hi Pavina,

Using the example I was able to create a custom filter textbox. I now want to put the filter menu besides the custom filter. Just like how the normal radgrid does the filtering by selecting the menu. Do you have any working code that does this?

Thanks,
Raji

0
Pavlina
Telerik team
answered on 15 Nov 2011, 03:44 PM
Hi Raji,

To achieve your goal you could add Image Button and create your own RadContextMenu inside the FilterTemplate to cover the required functionality.

Greetings,
Pavlina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
Grid
Asked by
Alic W
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Raji
Top achievements
Rank 1
Share this question
or