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

Column header filter similar to Excel

8 Answers 109 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tahir
Top achievements
Rank 1
Tahir asked on 02 Oct 2013, 02:15 PM
Hi all,

Is it possible to have a dynamically value-driven filter drop down similar to Excel filtering? Basically, the menu would list all of the distinct values in that column, and the custom option. (Excel also shows sorting, but I already know how to enable that in RadGrid)

8 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 03 Oct 2013, 04:54 AM
Hi Tahir,

I guess you want to have a filter dropdown in one of your column headers and filter the RadGrid based on the values selected in that.Please try the following code snippet.

ASPX:
<telerik:GridBoundColumn UniqueName="ShipCity" DataField="ShipCity" HeaderText="ShipCity">
    <FilterTemplate>
        <telerik:RadComboBox ID="RadComboBoxCity" DataSourceID="SqlDataSource3" DataTextField="ShipCity" AutoPostBack="true" DataValueField="ShipCity" Height="100px" AppendDataBoundItems="true" runat="server" OnSelectedIndexChanged="FilterCombo_SelectedIndexChanged">          
        </telerik:RadComboBox>      
    </FilterTemplate>
</telerik:GridBoundColumn>
. . . . .
<asp:SqlDataSource ID="SqlDataSource3" ConnectionString="<%$ ConnectionStrings:Northwind_newConnectionString3 %>"
ProviderName="System.Data.SqlClient" SelectCommand="SELECT DISTINCT ShipCity FROM Orders"
runat="server"></asp:SqlDataSource>

C#:
protected void FilterCombo_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
{
    string filterExpression;
    filterExpression = "([ShipCity] = '" + e.Value + "')";
    RadGrid1.MasterTableView.FilterExpression = filterExpression;
    RadGrid1.MasterTableView.Rebind();
}

Hope this helps,else please elaborate on your requirements.
Thanks,
Princy
0
Robert
Top achievements
Rank 1
answered on 20 Oct 2013, 10:47 AM
Princy,

What he desires is to not have to display the filter bar under the column headers, which is a waste of space.

He wants to have a dropdown arrow on the right side of the columnn header cell and then drop down a checkbox list of values (UNDER the column header though not containing it) as seen in your new demo 'Checklist Filtering' on your grid page.

I too wish to know how to do this.

MS Project, MS Excel and MS Access all have this sort of feature. They (microsoft) do it right by not having to enable a 'filter' bar but instead put all the filter features accessible from one drop down. Slick stuff, and Telerik almost has it. Check out the attached screenshot of MS Project. Not that the dropdown is contained in the column header. *That* is efficient.

Do you think you can help us build it ?

Actually, you have it right here!! But how do you do this?? It isn't anywhere in the examples !! Can you give us an overview of how to do this?? Scroll down to the first screenshot in the post --
http://blogs.telerik.com/telerikmarketing/posts/10-10-22/q3-10-pre-release-series-telerik-extends-the-winforms-suite-with-new-lob-features.aspx


Thanks for your help !!!
0
Kostadin
Telerik team
answered on 23 Oct 2013, 03:31 PM
Hello Robert,

If you check out closely at the link which you provided you will notice that this feature is added into the WinForm control suite and not in ASP.NET AJAX controls. Nevertheless you could check out the following code library where one of the columns demonstrates how to achieve that by using a RadComboBox. Additionally you could check out the second grid from the following live example which demonstrates another approach to achieve that.

Regards,
Kostadin
Telerik
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 the blog feed now.
0
Robert
Top achievements
Rank 1
answered on 23 Oct 2013, 03:41 PM
Kostadin,

I appreciate your reply, however I'm not getting the idea that the ASP.NET group gets it.

Please go and check out how Excel, Project and Access does filtering.

All of your demos that you and your other associates keep pointing me to are examples that have a FILTER BAR, and none of you guys seem to understand that countless numbers of us (i've read many others asking for this) would like to have the filter DROPDOWN from the grid column header, by clicking on some sort of down arrow that would be positioned to the right of the column header cell.

Everytime I demo my software, my users keep asking me why can't I build my software like Excel and why I keep insisting they use the 'stupid -- their words' filter bar.

Can you get with some of your guys in the ASP.NET group and ask them how to do this?

Thanks Kostadin,

Robert
0
Kostadin
Telerik team
answered on 28 Oct 2013, 10:03 AM
Hello Robert,

Could you please review the previously provided link more closely? In the live example if you click on any of the buttons on the CheckList Filtering example you will notice that a dropdown list with CheckBoxes is opened which allows you to filter the same way as you do it in Excel. On the other hand the code library project demonstrates the same technique by using the RadComboBox control. The associated column is named EmployeeID. If you read the comments below the description you will notice that the same question is already asked there and one of my colleagues has provided a reply.

Regards,
Kostadin
Telerik
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 the blog feed now.
0
Tarek
Top achievements
Rank 1
answered on 25 Nov 2013, 11:11 AM
Robert means that he want the filter button showed next to the header not below it in a new row (Like Kendo Grid). Is it possible ?
0
Albert Shenker
Top achievements
Rank 1
Veteran
Iron
answered on 27 Nov 2013, 05:43 PM
I think what Robert is really getting at is... why do Asp.Net Ajax users have to keep implementing hacks and complicated code libraries in order to have common sense functionality which other Telerik groups (WinForms, Silverlight) seem to think should be available out of the box.
0
Kostadin
Telerik team
answered on 28 Nov 2013, 08:50 AM
Hello,

Our developers are currently working of improving the filter and I hope that the new filter functionality will be implemented in a near future. Nevertheless we have an example which demonstrates how to add a filter button to the header and use the ContextMenu to filter the column. The example could be found at the following link.

Regards,
Kostadin
Telerik
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 the blog feed now.
Tags
Grid
Asked by
Tahir
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Robert
Top achievements
Rank 1
Kostadin
Telerik team
Tarek
Top achievements
Rank 1
Albert Shenker
Top achievements
Rank 1
Veteran
Iron
Share this question
or