RadGrid drop-down filter with multi-select

Posted by Community Admin on 03-Aug-2018 11:35

RadGrid drop-down filter with multi-select

All Replies

Posted by Community Admin on 06-Jul-2011 00:00

Hi,

I am currently using a RadGrid with drop-down filter similar to the one from this example :
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/filtertemplate/defaultcs.aspx .

I currently use GridTemplateColumn like this :

<telerik:GridTemplateColumn UniqueName="Region" DataField="Region" HeaderText="Region"
                                SortExpression="Region" FilterControlWidth="40%" AutoPostBackOnFilter="true"
                                CurrentFilterFunction="EqualTo">
                                <HeaderStyle Width="9%" />
                                <FilterTemplate>
                                    <telerik:RadComboBox ID="regionFilterCombo" runat="server" Width="100%" AutoPostBack="true"
                                        Sort="Ascending" SortCaseSensitive="false" AllowCustomText="true" Height="120px"
                                        OnSelectedIndexChanged="FilterRegion">
                                    </telerik:RadComboBox>
                                </FilterTemplate>
                                <ItemTemplate>
                                    <asp:Label runat="server" ID="lblRegion" Text='<%# Eval("Region")%>'>
                                    </asp:Label>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
 
The filter is populated from the code-behind using a list of strings containing the possible values for the filter :
private void BindFilter(RadComboBox filterCombo, List<string> items, string filterValue)
        
            if (items.Contains(string.Empty))
            
                items.Remove(string.Empty);
            
 
            filterCombo.DataSource = items;
            filterCombo.Sort = RadComboBoxSort.Ascending;
            filterCombo.DataBind();
            filterCombo.Items.Sort();
            filterCombo.SelectedValue = filterValue;
        

The filter is working fine, but I want to add multi-select behavior to the filter dropdown.
I tried modifying the ItemTemplate for the drop-down  like this :
<FilterTemplate>
    <telerik:RadComboBox ID="regionFilterCombo" runat="server" Width="100%" AutoPostBack="true"
        Sort="Ascending" SortCaseSensitive="false" AllowCustomText="true" Height="120px"
        DataValueField= "Region" OnSelectedIndexChanged="FilterRegion">
        <ItemTemplate>
            <div onclick="StopPropagation(event)">
                <asp:CheckBox runat="server" ID="chk1" Checked="false" />
                <asp:Label runat="server" ID="Label1" AssociatedControlID="chk1" Text='<%# Eval("Region")%>' />
            </div>
        </ItemTemplate>
    </telerik:RadComboBox>
</FilterTemplate>

but it gives me an error : DataBinding: 'System.String' does not contain a property with the name 'Region' .
Do you have any ideas of how I can bind the ItemTemplate from the drop-down? Or maybe you know other approaches..
Any help is greatly appreciated.

Posted by Community Admin on 08-Jul-2011 00:00

Hi Morty,

The project in the code library below shows how you could use Multi-Selection RadComboBox (with checkboxes in ItemTemplate) in the FilterTemplate of RadGrid. Give it a try and see if it works for you:
http://www.telerik.com/community/code-library/aspnet-ajax/grid/multi-selection-radcombobox-for-filtering-grid.aspx

Kind regards,
Pavlina
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Posted by Community Admin on 08-Jul-2011 00:00

Hi Pavlina,

Thanks for the quick reply. I solved my problem using a similar aproach (using an ItemTemplate).

Posted by Community Admin on 10-Nov-2011 00:00

Hi,
 We have a similar requirement of using multi select list as a filter option inside grid. We are using MVC3 razor. Is this RadGrid with multiselect dropdown(as discussed in same post) supports MVC3(our requirement).

Posted by Community Admin on 15-Nov-2011 00:00

Hi Susheel,

If you have any questions about our MVC extensions you can open a support ticket or write in the MVC forums.

All the best,
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

Posted by Community Admin on 05-Apr-2012 00:00

HI Pavlina,
I Have dynamically generated RadGrid with Template filter columns .
I can only filter with RadComboBox and i want filter this with multiple radcomboBox ....
all these combo and rad grid is dynamically generated.

Posted by Community Admin on 06-Apr-2012 00:00

Hello Rohan,

I am afraid that I can not understand what exactly you want to achieve. Can you please elaborate a bit more in the details? What you mean by "I can only filter with RadComboBox and i want filter this with multiple radcomboBox"?

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.

Posted by Community Admin on 24-Jul-2012 00:00

Hi Pavlina,
I Have dynamically generated RadGrid with Template columns. All the columns are dynamically created. One of the template column has a filter with multiselect radcomboBox. I need to perform filtering based on the values selected in the multiselect radcomboBox.
I have seen demos for multiselect combobox but they have static columns in RadGrid.

Your help is appreciated.

Posted by Community Admin on 24-Jul-2012 00:00

Hello,

What you can do is to open a formal support ticket and send us the problematic project there for further investigation. Thus we will be able to observe the described issue and advice you further.

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.

This thread is closed