Multi-Selection RadComboBox for filtering grid

15 posts, 0 answers
  1. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 01 Sep 2009 Link to this post

    Requirements

    RadControls version

     2009.1.311+

    .NET version

    2.x/3.x

    Visual Studio version

    2005/2008

    programming language

    C#, Javascript

    browser support

    all browsers supported by RadControls


    PROJECT DESCRIPTION

    This project shows how you could use Multi-Selection RadComboBox (with checkboxes in ItemTemplate) in the FilterTemplate of RadGrid. The application allows the user to filter the grid when checking/unchecking the checkboxes placed in the radcombobox itself. On clicking the checkbox, it loops through each combo item and and gets the unselected items and then passes the corresponding values to the server through an ajax request. Then in the code behind a query is created based on the
    passed values (here, unselected item values) and the radgrid is populated accordingly.

    Thanks,
    Princy.

  2. Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 08 Sep 2009 Link to this post

    Hello Princy,

    Thank you for the provided example - I updated it to support multi-column filtering and keep the dropdown of the RadComboBox editor expanded after filter operation triggered from it. I also added 'Clear filters' button below the grid to reset the data.

    However, I should outline two important things concerning the approach you chose:

    1. It can slow down the overall grid performance when having large amount of items displayed in the combobox.
    2. The number and state of the checkboxes inside the combobox dropdown will not be updated when you apply filters through the rest of the grid columns.

    Your Telerik MVP tokens have been updated for the involvement.

    Best regards,
    Sebastian
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Dheeraj
    Dheeraj avatar
    17 posts
    Member since:
    Apr 2010

    Posted 07 Dec 2010 Link to this post

    Hi Princy,

    <telerik:GridBoundColumn DataField="Department" HeaderText="FIlter Department" SortExpression="Department"
                                UniqueName="DepartmentFilter" HeaderStyle-Width="180px">
                                <FilterTemplate>
                                    <telerik:RadComboBox ID="RadComboBox1" runat="server" DataSource='<%# BindDepartmentValues() %>'
                                        DataValueField="Department" DataTextField="Department" EmptyMessage="All Types"
                                        AllowCustomText="true" Width="160px">
                                        <ItemTemplate>
                                           <div class="combo-item-template" >
                                            <asp:CheckBox runat="server" Checked="false" ID="chk1" onclick="onCheckBoxClick(this)" />
                                            <asp:Label ID="lblDepartment" runat="server" Text='<%# Eval("Department")%>' />
                                            </div>
                                        </ItemTemplate>
                                    </telerik:RadComboBox>
    </FilterTemplate>
                            </telerik:GridBoundColumn>

    In above code I have to select multiple department values from Combobox and on select I have to filter the grid(but it should be in conjunction with grid default functionality).
    With this functionality I also want the Default Filter icon and functionality provided by telerik with(value like: Contains, Starts With,Equal To Not Equal To etc ).When I select any option from this it should take the text from Editable combobox and filter based on it.

    could you please suggest me regarding this how to achive both functionalities for the same column.

    Regards,
    Dheeraj
  4. Neil
    Neil avatar
    11 posts
    Member since:
    Apr 2011

    Posted 17 Aug 2011 Link to this post

    Hi,

    Im having a problem with this example code. The inital request when clicking on a tick box in the filter is passed okay, but subsiquent clicks on tick box items cause a 'null' is null or not an object on the line:

    $find(

    "<%=RadAjaxManager1.ClientID%>").ajaxRequest("ExampleID," + text);

    Is there a way to resolve this?

    Thanks,
    Neil

     

  5. Mira
    Admin
    Mira avatar
    1124 posts

    Posted 23 Aug 2011 Link to this post

    Hello Neil,

    Our system indicates that you have opened a support ticket concerning the same issue.

    In order to avoid duplicate posts, I suggest that we continue the communication in the support ticket.

    All the best,
    Mira
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

  6. Shekhar
    Shekhar avatar
    3 posts
    Member since:
    Jul 2011

    Posted 07 Sep 2011 Link to this post

    Hi,

    I would like to know how can I use multiselect RadcomboBox filtering along with the default filter options.

    Thanks
    Shekhar
  7. Nicolas
    Nicolas avatar
    3 posts
    Member since:
    Mar 2011

    Posted 10 Nov 2011 Link to this post

    Is it easy to combine 2 multi-selection RadCombobox ?In fact, I also need that but with 2 or 3 columns being filter with comboboxes.
    Users can choose multiple values in different RadCombo and filter the result on not 1 combobox but on the different values selected in the different radcombox.

    Nicolas
  8. Hsan
    Hsan avatar
    2 posts
    Member since:
    Jul 2012

    Posted 02 Jul 2012 Link to this post

    Hello,
    I 'd like to know how to filter multiple data in telerik mulitcombobox in widows.I'd like to search many data from multicombobox.Please reply me.
  9. Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 02 Jul 2012 Link to this post

    Hello Hsan,

    This code library concerns our ASP.NET AJAX grid. If you have questions about how to implement it with RadControls for Winforms, start a separate forum thread or support ticket on this subject, under the respective product category. Thank you.

    Regards,
    Sebastian
    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.
  10. Prasanna
    Prasanna avatar
    2 posts
    Member since:
    Jul 2012

    Posted 23 Jul 2012 Link to this post

    Hi,

    The code attached is very useful.
    But in my case I am creating the RadGrid columns dynamically. So i need to create the Multi-Selection RadComboBox in the filter template of a template column.

    Please help me out in this.
  11. Eyup
    Admin
    Eyup avatar
    3005 posts

    Posted 30 Oct 2012 Link to this post

    Multi-Selection RadComboBox for filtering using LINQ Expressions

    RadControls version

     Required 2011 Q2+ ( Q3 for Metro Skin )

    .NET version

    4

    Visual Studio version

    2010

    programming language

    C#, VB

    browser support

    all browsers supported by RadControls


    PROJECT DESCRIPTION

    This project demonstrates how to use the auto-implemented CheckBoxes in RadComboBox to filter RadGrid items with multiple values from a single DataField using LINQ Expressions. Therefore, the EnableLinqExpressions property of the grid should be set to True. The user checks any number of Countries from the "RadComboBoxCountry" placed in the FilterTemplate of the "ShipCountry" column. Then, upon clicking the "ImageButton1", a FilterExpression is being applied created with OR statements to hold the multiple values checked by the user.

    Greetings,
    Eyup
    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.
  12. gc_0620
    gc_0620 avatar
    225 posts
    Member since:
    Feb 2008

    Posted 19 Jun 2013 Link to this post

    Hi Eyup,

    My environment:  VS 2010 with  RadControls for ASP.NET AJAX Q1 2013 SP2.
     
    Using RadGridFilterMultipleChecked.zip as prototype, my Radgrid/MasterTableView uses LinqDataSource as DatasourceId instead of SqlDataSource.  But ImageButton1 (In GridBoundColumn "ShipCountry") OnClick event,  I am getting below error message:

    Line: 15
    Error: Sys.WebForms.PageRequestManagerServerErrorException: No applicable indexer exists in type 'Order'
     

    However with LinqDatasource, I am able to  use built in Filters for other bound columns; not an issue. Please see attached screen printout.
    This code library works perfectly with SqlDataSource.  Anyway below is my complete Grid/Datasource Markup.

    Sincerely

    gc_0620

    <telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" CellSpacing="0"
            DataSourceID="LinqDataSource1" GridLines="None" Width="800px" AllowFilteringByColumn="True"
            EnableLinqExpressions="true" OnItemDataBound="RadGrid1_ItemDataBound" OnPreRender="RadGrid1_PreRender"
            OnItemCommand="RadGrid1_ItemCommand" Skin="Vista" AllowSorting="True">
            <MasterTableView DataSourceID="LinqDataSource1" AutoGenerateColumns="False" en DataKeyNames="OrderID">
                <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
                <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
                    <HeaderStyle Width="20px"></HeaderStyle>
                </RowIndicatorColumn>
                <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
                    <HeaderStyle Width="20px"></HeaderStyle>
                </ExpandCollapseColumn>
                <Columns>
                    <telerik:GridBoundColumn DataField="OrderID" DataType="System.Int32" FilterControlAltText="Filter OrderID column"
                        HeaderText="OrderID" ReadOnly="True" SortExpression="OrderID" UniqueName="OrderID">
                    </telerik:GridBoundColumn>
                    <telerik:GridDateTimeColumn DataField="OrderDate" DataType="System.DateTime" FilterControlAltText="Filter OrderDate column"
                        HeaderText="OrderDate" SortExpression="OrderDate" UniqueName="OrderDate">
                    </telerik:GridDateTimeColumn>
                    <telerik:GridNumericColumn DataField="Freight" DataType="System.Decimal" FilterControlAltText="Filter Freight column"
                        HeaderText="Freight" SortExpression="Freight" UniqueName="Freight">
                    </telerik:GridNumericColumn>
                    <telerik:GridBoundColumn DataField="ShipName" FilterControlAltText="Filter ShipName column"
                        HeaderText="ShipName" SortExpression="ShipName" UniqueName="ShipName">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="ShipCountry" FilterControlAltText="Filter ShipCountry column"
                        HeaderText="ShipCountry" SortExpression="ShipCountry" UniqueName="ShipCountry">
                        <FilterTemplate>
                            <telerik:RadComboBox ID="RadComboBoxCountry" DataSourceID="SqlDataSource2" DataTextField="ShipCountry"
                                DataValueField="ShipCountry" Height="100px" AppendDataBoundItems="true" CheckBoxes="true"
                                runat="server" EmptyMessage="Select Countries" Skin="Vista">
                            </telerik:RadComboBox>
                            <asp:ImageButton ID="ImageButton1" runat="server" AlternateText="Filter" ToolTip="Filter by Country"
                                OnClick="ImageButton1_Click" ImageUrl="~/worldSearch.png" />
                        </FilterTemplate>
                    </telerik:GridBoundColumn>
                </Columns>
                <EditFormSettings>
                    <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                    </EditColumn>
                </EditFormSettings>
            </MasterTableView>
            <FilterMenu EnableImageSprites="False">
            </FilterMenu>
        </telerik:RadGrid>

    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:NorthWindConnectionString %>"
            SelectCommand="SELECT [OrderID], [OrderDate], [Freight], [ShipName], [ShipCountry] FROM [Orders]">
        </asp:SqlDataSource>
        <br />
        <asp:LinqDataSource ID="LinqDataSource1" runat="server" ContextTypeName="DataClassesDataContext"
            EntityTypeName="" Select="new (OrderID, OrderDate, Freight, ShipName, ShipCountry)"
            TableName="Orders">
        </asp:LinqDataSource>
        <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:NorthWindConnectionString %>"
            SelectCommand="SELECT DISTINCT ShipCountry FROM Orders ORDER BY ShipCountry">
        </asp:SqlDataSource>


    ,  

     

  13. Eyup
    Admin
    Eyup avatar
    3005 posts

    Posted 25 Jun 2013 Link to this post

    Hi Ghulam,

    It seems that you have RadAjax on your page and it prevents a server side error. Please temporarily disable any ajaxification on the page and see whether a more informative error will occur.

    It will be very helpful if you open a support ticket and send us a very basic runnable sample web site demonstrating the problematic behavior. Thus, we will be able to further analyze and debug the application and provide a proper solution.

    Regards,
    Eyup
    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.
  14. THANGARAI
    THANGARAI avatar
    21 posts
    Member since:
    Nov 2013

    Posted 18 Apr 2014 in reply to Princy Link to this post

    Hi Princy,

    I have a RadComboBox  with checkbox. while I'm selecting multiple items , its getting selected
    but   not showing the selected items.

    please provide solution for this case.

  15. Eyup
    Admin
    Eyup avatar
    3005 posts

    Posted 23 Apr 2014 Link to this post

    Hello Thangarai,

    Please download and run the RadGridFilterMultipleChecked.zip web site and verify that it works as expected on your end. You can also check the following post for alternative solutions:
    http://www.telerik.com/forums/handle-multi-selection-filtering-in-a-custom-column-class#BXO3l-tvhEOctiRAm-FncA

    Hope this helps.

    Regards,
    Eyup
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top