RadCombobox Check All server side event

3 posts, 0 answers
  1. Ruby
    Ruby avatar
    9 posts
    Member since:
    Sep 2012

    Posted 18 Oct 2012 Link to this post

    I have a radcombobox with checkboxes and Multiple values in the drop-down, when I check  values in the radcombobox , OnitemChecked server side event is called and based on the values checked data shows up on the page.

    But when I checked Select All for Checkboxes, no event is called. Could someone please suggest  me which event is related to the Select All Checkboxes feature
    <telerik:RadComboBox ID="uxRCBCustomerName" runat="server" Width="200px" EnableCheckAllItemsCheckBox="true"
                DropDownWidth="500px"  height="120px" DataTextField="HPDCustomerName" DataValueField="HPDCustomerID"  AllowCustomText="true" CheckBoxes="true"  DataKeyField="employerGroupID" EmptyMessage="No Promo Found" AutoPostBack="true" CheckedItemsTexts="DisplayAllInInput"   AppendDataBoundItems="true" OnItemChecked="uxRCBCustomerName_ItemChecked"   EnableViewState="true" MarkFirstMatch="true" CausesValidation="false" >
               <ItemTemplate>
                                  
                                   <ul
                       <li class="col1" >
                       <%# DataBinder.Eval(Container, "Text")%>
                        </li>
                          <li class="col2">         
                           <%# If(DataBinder.Eval(Container.DataItem, "hasJOnly"), "J", "")%><%# If(DataBinder.Eval(Container.DataItem, "hasJM"), "JM", "")%><%# If(DataBinder.Eval(Container.DataItem, "hasJOnly")=False and DataBinder.Eval(Container.DataItem, "hasJM")=false, "N/A", "")%></td>
                                               
                       </li>  
                       </ul>
                                         
                     
               </ItemTemplate>
           </telerik:RadComboBox>

    I am looking for a server side event. Please see my code above for radcombobox.

    Thanks,
  2. Nencho
    Admin
    Nencho avatar
    1871 posts

    Posted 19 Oct 2012 Link to this post

    Hi Ruby,

    In order to capture if the CheckAll checkbox is checked, you could use the following approach at the OnClientLoad event handler:

    <script type="text/javascript">
           function onLoad(sender) {
               $telerik.$('.rcbCheckAllItemsCheckBox').change(function () {
                 alert("CheckAll CheckBox checked")
     
               });
           }   
       </script>

    In addition, you could perform a PostBack in the "change" event handler with __doPostBack(), in order to capture the selection at server-side.

    Kind regards,
    Nencho
    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.
  3. Ruby
    Ruby avatar
    9 posts
    Member since:
    Sep 2012

    Posted 23 Oct 2012 Link to this post

    If someone is still looking for the solution, use OnClientBlur
    http://www.telerik.com/community/forums/aspnet-ajax/combobox/postback-on-sele
    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Default" %>
       
       
    <head runat="server">
        <title></title>
        <telerik:RadStyleSheetManager id="RadStyleSheetManager1" runat="server" />
    </head>
    <body>
        <form id="form1" runat="server">
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
            <Scripts>
                <%--Needed for JavaScript IntelliSense in VS2010--%>
                <%--For VS2008 replace RadScriptManager with ScriptManager--%>
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
            </Scripts>
        </telerik:RadScriptManager>
        <script type="text/javascript">
            function IsCheckAllSelected(sender, eventArgs) {
                var itemCount = sender.get_items().get_count();
                var selectedItemCount = sender.get_checkedItems().length;
                if (selectedItemCount == itemCount) {
                    alert('check-all was checked')
                    __doPostBack('RadComboBox1', 'Check All');
                }
                else {
                    return 0
                }
            }
       
        </script>
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        </telerik:RadAjaxManager>
        <div>
            <telerik:RadComboBox ID="RadComboBox1" runat="server" CheckBoxes="true" EnableCheckAllItemsCheckBox="true"
                Width="300px" OnClientBlur="IsCheckAllSelected" >
                <items>
                        <telerik:RadComboBoxItem Text="Arts" />
                        <telerik:RadComboBoxItem Text="Biographies" />
                        <telerik:RadComboBoxItem Text="Children's Books" />
                        <telerik:RadComboBoxItem Text="Computers � Internet" />
                        <telerik:RadComboBoxItem Text="Cooking" />
                        <telerik:RadComboBoxItem Text="History" />
                        <telerik:RadComboBoxItem Text="Fiction" />
                        <telerik:RadComboBoxItem Text="Mystery" />
                        <telerik:RadComboBoxItem Text="Nonfiction" />
                        <telerik:RadComboBoxItem Text="Romance" />
                        <telerik:RadComboBoxItem Text="Science Fiction " />
                        <telerik:RadComboBoxItem Text="Travel" />
                    </items>
            </telerik:RadComboBox>
        </div>
        <asp:Label ID="itemsClientSide" runat="server" Text=""></asp:Label>
        </form>
    </body>
    </html>
Back to Top