How can I keep the current default button?

2 posts, 0 answers
  1. Stuart Hemming
    Stuart Hemming avatar
    1622 posts
    Member since:
    Jul 2004

    Posted 04 Nov 2011 Link to this post

    I have a splitbutton in a toolbar.

    I have a number of options, but I want the fist one to be the default, always; even if they user clicks on the dropdown and selets a different child button.

    That is, if I have
    <telerik:RadToolBarSplitButton CommandName="Action" EnableDefaultButton="true" DefaultButtonIndex="0" >
        <Buttons>
            <telerik:RadToolBarButton runat="server"
                                    CommandArgument="Local"
                                    Text="Local">
            </telerik:RadToolBarButton>
            <telerik:RadToolBarButton runat="server"
                                    CommandArgument="Window"
                                    Text="Local">
            </telerik:RadToolBarButton>
        </Buttons>
    </telerik:RadToolBarSplitButton>

    When the user clicks on the button proper, I want Add(Local) to execute. If they click on the dropdown and select Add(Window), I want Add(Window) to execute but I want Add(Local) to remain the default button.

    I'm getting it all to work, except for the last bit.

    I've tried calling set_defaultButtonIndex(0) in both the ClientClicking and ClientClicked events but to no avail.

    Appreciate any hints.

    --
    Stuart

  2. Kate
    Admin
    Kate avatar
    1898 posts

    Posted 09 Nov 2011 Link to this post

    Hi Stuart,

    Simply change the EnableDefaultButton property to false and the default button will remain the text that you set to the splitbutton itself as in this demo:
    <telerik:RadToolBarSplitButton CommandName="Action" EnableDefaultButton="false" Text="Default" DefaultButtonIndex="0">
                        <Buttons>
                            <telerik:RadToolBarButton runat="server" CommandArgument="Local" Text="Local1">
                            </telerik:RadToolBarButton>
                            <telerik:RadToolBarButton runat="server" CommandArgument="Window" Text="Local2">
                            </telerik:RadToolBarButton>
                        </Buttons>
                    </telerik:RadToolBarSplitButton>

    Greetings,
    Kate
    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. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top