+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / RadGrid drop-down filter with multi-select

RadGrid drop-down filter with multi-select

9 posts, 1 answered
  1. morty
    morty avatar
    2 posts
    Registered:
    05 May 2011
    06 Jul 2011
    Link to this post
    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.
  2. Pavlina
    Pavlina avatar
    5 posts
    Registered:
    06 Dec 2016
    08 Jul 2011
    Link to this post
    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!

    Answered
  3. morty
    morty avatar
    2 posts
    Registered:
    05 May 2011
    08 Jul 2011
    Link to this post
    Hi Pavlina,

    Thanks for the quick reply. I solved my problem using a similar aproach (using an ItemTemplate).
  4. susheel
    susheel avatar
    1 posts
    Registered:
    10 Nov 2011
    10 Nov 2011
    Link to this post
    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).
  5. Pavlina
    Pavlina avatar
    5 posts
    Registered:
    06 Dec 2016
    15 Nov 2011
    Link to this post
    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
  6. Rohan
    Rohan avatar
    1 posts
    Registered:
    05 Jul 2012
    05 Apr 2012
    Link to this post
    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.
  7. Pavlina
    Pavlina avatar
    5 posts
    Registered:
    06 Dec 2016
    06 Apr 2012
    Link to this post
    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.
  8. Prasanna
    Prasanna avatar
    1 posts
    Registered:
    23 Jul 2012
    24 Jul 2012
    Link to this post
    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.
  9. Pavlina
    Pavlina avatar
    5 posts
    Registered:
    06 Dec 2016
    24 Jul 2012
    Link to this post
    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.
9 posts, 1 answered