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

RadGrid filter with drop down - declaratively!

5 Answers 222 Views
Grid
This is a migrated thread and some comments may be shown as answers.
PH
Top achievements
Rank 2
PH asked on 07 Jun 2009, 11:30 PM
Hi All,

I wonder if there is a declarative way to define a filter column to be controlled by a drop down list box? 

This is something we need all the time - typical scenario is looking up a value from a related table (e.g. categories for parts in NorthWind database).  Our previous component suite made this very easy and I was surprised to see this wasn't a case of setting a few switches in the column properties.

There is a fairly tortuous example on Telerik's website whereby a custom class is defined: there follows much messing around in the page load event and other routines have to be written to hold the thing together.  Just seems a very surprising omission from what is a very accomplished suite.

This completes an evaluation of Telerik which has gone very well, save for this one surprising omission in functionality.

Any help much appreciated!

Peter Hearn

5 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 1
answered on 08 Jun 2009, 07:52 AM
Hello,

You can add dropdown filters for GridBoundColumns declaratively by just setting AllowFilteringByColumn = true for the entire grid and defining FilterTemplate(available with Q1 2009 i.e., version 2009.1.311 and later versions) for the required column. Check out the online demo which illustrates this functionality:
Filter Template

In the first example you will see that a ComboBox is placed in the filterTemplate of the GridBoundColumn. The filtering is triggered intercepting the OnClientSelectedIndexChanged event of RadComboBox and calling the filter(colUniqueName, valueToCompare, filterFunction) client method of the grid.

Hope this helps
Princy.
0
PH
Top achievements
Rank 2
answered on 08 Jun 2009, 10:00 AM
Hi Princy,

Thanks for your reply - this was exactly what I was looking for!  This method is actually much more powerful than our previous vendor's offering so I'm very glad I asked.

Can you just confirm that to define the filter template, I need to edit the aspx source directly?  I just want to be sure I'm not missing a way of doing that through the properties settings dialog box.

Thanks,
Peter
 
0
Michael
Top achievements
Rank 1
answered on 15 Jun 2009, 06:24 PM
Hi
I cant get your dropdown filter to work using the code in the example
Is there some code missing?

I copied the code and removed all references to
<%@ Register TagPrefix="telerik" TagName="Footer" Src="~/Common/Footer.ascx" %>
<%@ Register TagPrefix="telerik" TagName="HeadTag" Src="~/Common/HeadTag.ascx" %>
<%@ Register TagPrefix="telerik" TagName="Header" Src="~/Common/Header.ascx" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.QuickStart" %>


I can view in browser but all i see is the grid with the standard filter row

I dont see where you load the drop downs or where filterexpression gets loaded

I have spent two days now in this very frushtating endevour

I am new to AJAX and chose to use use controls because of the the supurb documentation and because i neeed this drop down capability

Please help

Mike Hills

0
Sebastian
Telerik team
answered on 16 Jun 2009, 07:06 AM
Hello Michael,

You can find the example along with its source code under your local RadControls installation in the following default location:
 
C:\Program Files\telerik\RadControls for ASPNET AJAX Q1 2009\Live Demos\Grid\Examples\Programming\filtertemplate

You may also review the code implementation from the relevant online demo navigating between the tabs right under the example.

Kind regards,
Sebastian
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
Michael
Top achievements
Rank 1
answered on 16 Jun 2009, 11:18 AM
Thank you
Im glad you are in a different time zone and replied so quickly
I hadnt realized that folder exisited

So i tried running it from that folder - same problem

I discovered the problem with the missing code
Its uncle Bill again (Gates that is) - I had hit the rebuild solution and it wiped out all the javascript - weird

Luckily I had zipped the sub-directory before I tried this - so I tried again without rebuilding and now it works
Tags
Grid
Asked by
PH
Top achievements
Rank 2
Answers by
Princy
Top achievements
Rank 1
PH
Top achievements
Rank 2
Michael
Top achievements
Rank 1
Sebastian
Telerik team
Share this question
or