RadCombo in Toolbar

3 posts, 1 answers
  1. Imran
    Imran avatar
    25 posts
    Member since:
    Mar 2009

    Posted 29 Apr 2010 Link to this post

    Hello

    I have a RadCombo in the template for a RadToolBarButton in the RadToolBarDropDown.

    I want to allow the user to make a selection from the Combo Box and then have him click the RadToolBarButton to perform the post back.

    As soon as a selection is made from the combo box the RadToolBarDropDown closes. 

    I want to be able to leave the RadToolBarDropDown open after a selection has been made in the combo box and hence avoid an extra click which is currently needed to reopen RadToolBarDropDown. 

    I have attached the image with this message.

    Any insight will be greatly appreciated.

    Thanks
    Imran

     
  2. Answer
    Yana
    Admin
    Yana avatar
    4554 posts

    Posted 05 May 2010 Link to this post

    Hello Imran,

    You should use OnClientDropDownOpening and OnClientDropDownClosed events of the combobox to mark whether the dropdown button should be closed like this:

    <telerik:RadToolBar ID="RadToolBar1" runat="server" OnClientDropDownClosing="dropDownClosing">
        <Items>
            <telerik:RadToolBarDropDown Text="dropdown">
                <Buttons>
                    <telerik:RadToolBarButton Text="dropdown 1" />
                    <telerik:RadToolBarButton>
                        <ItemTemplate>
                            <telerik:RadComboBox ID="RadComboBox1" runat="server"  OnClientDropDownOpening="dropDownOpening"
                                OnClientDropDownClosed="dropDownClosed">
                                <Items>
                                    <telerik:RadComboBoxItem Text="item1" />
                                    <telerik:RadComboBoxItem Text="item2" />
                                    <telerik:RadComboBoxItem Text="item3" />
                                </Items>
                            </telerik:RadComboBox>
                        </ItemTemplate>
                    </telerik:RadToolBarButton>
                </Buttons>
            </telerik:RadToolBarDropDown>
        </Items>
    </telerik:RadToolBar>

    and the needed javascript:

    <script type="text/javascript">
        var shouldClose = true;
     
        function dropDownOpening(sender, args) {
            shouldClose = false;
        }
     
        function dropDownClosed(sender, args) {
            shouldClose = true;
        }
     
        function dropDownClosing(sender, args) {
            if (!shouldClose)
                args.set_cancel(true);
        }
    </script>


    Greetings,
    Yana
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Imran
    Imran avatar
    25 posts
    Member since:
    Mar 2009

    Posted 05 May 2010 Link to this post

    Sweet it worked like a charm. Thanks.
Back to Top