This is a migrated thread and some comments may be shown as answers.

How can I keep the current default button?

1 Answer 38 Views
ToolBar
This is a migrated thread and some comments may be shown as answers.
Stuart Hemming
Top achievements
Rank 2
Stuart Hemming asked on 04 Nov 2011, 03:22 PM
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

1 Answer, 1 is accepted

Sort by
0
Kate
Telerik team
answered on 09 Nov 2011, 01:22 PM
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
Tags
ToolBar
Asked by
Stuart Hemming
Top achievements
Rank 2
Answers by
Kate
Telerik team
Share this question
or