Select all/none on RadComboBox

2 posts, 0 answers
  1. Charles
    Charles avatar
    75 posts
    Member since:
    Aug 2008

    Posted 15 Apr 2011 Link to this post

    I am using a RadComboBox with an ItemTemplate like this (to show checkboxes for each item):

    <ItemTemplate>
         <asp:CheckBox runat="server" ID="chk1"/>
          <asp:Label runat="server" ID="lbllist" AssociatedControlID="chk1" Text='<%# Eval("ComputerName") %>'></asp:Label>
    </ItemTemplate>

    I further need to implement a couple of linkbuttons in a single row at the top that will allow the user to select all or select none. Finally, the alternating grid lines would be a "nice-to-have". I've included a screenshot of the standards that I need to meet. Step two in that graphic is about where I need to be when the user drops down the combo.

    Any help would be appreciated. Thanks.
  2. Dimitar Terziev
    Admin
    Dimitar Terziev avatar
    1268 posts

    Posted 21 Apr 2011 Link to this post

    Hello Charles,

    Regarding these link buttons on the top of the list with RadComboBox items, you could use the header template.

    In order to show the number of items selected when the drop-down of the RadComboBox is closed, you should subscribe on the OnClientDropDownClosing client-side event and used the following event handler function:

    function OnClientDropDownClosing(sender, args) {
     
        var checkboxes = $telerik.$('input:checkbox:checked', sender.get_dropDownElement());
     
        if (checkboxes.length > 0) {
     
            sender.set_text(checkboxes.length + " Selected")
        }
        else {
     
            sender.set_text("Select one or more");
        }
         
    }

    I hope this would help you out.


    All the best,
    Dimitar Terziev
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Back to Top