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

RadToolBarButton with CheckOnClick

5 Answers 107 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Yenza
Top achievements
Rank 1
Yenza asked on 27 Mar 2015, 07:30 AM
So I have a problem with marking buttons in a RadToolBarDropDown.

If I'm simply using a RadToolBarButton with the CheckOnClick="true" outside of a RadToolBarDropDown it works perfectly but when I have it inside of one it doesn't mark it anymore for an unknown reason.

What I'm trying to create is to have this dropdown list where I have 3 options of what people want to "toggle on/off". So they click on the dropdown, pick one of the options to toggle it off which should then be marked/checked in some manner so they know it has been toggled off. I don't seem to get it to work.Any ideas how to solve this?

<telerik:RadToolBarDropDown runat="server" ToolTip="Show/Hide" ImageUrl="~/Images/icon.png">
    <Buttons>
          <telerik:RadToolBarButton runat="server" Text="Walls" Value="TOGGLE_WALLS" />
          <telerik:RadToolBarButton runat="server" Text="Floor" Value="TOGGLE_FLOOR" />
          <telerik:RadToolBarButton runat="server" Text="Roof" Value="TOGGLE_CEILING" />
    </Buttons>
</telerik:RadToolBarDropDown>

5 Answers, 1 is accepted

Sort by
0
Yenza
Top achievements
Rank 1
answered on 30 Mar 2015, 11:16 AM
No ideas? :/

Seems it should be really simple really... just having a toggle function of a button in a dropdown switching between Checked= true/false
0
Ivan Danchev
Telerik team
answered on 31 Mar 2015, 03:52 PM
Hello,

I am afraid, buttons in the RadToolBarDropDown does not have the same functionality as regular RadToolBarButtons and cannot display "on" and "off" states.

Regards,
Ivan Danchev
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
0
Yenza
Top achievements
Rank 1
answered on 01 Apr 2015, 05:17 AM
Alright, so it doesn't support the "standard" functions of toggling.

Can we change the background manually perhaps or some kind of work-around to make the toggling work?
0
Accepted
Ivan Danchev
Telerik team
answered on 03 Apr 2015, 04:05 PM
Hello,

One possible workaround could be adding a "checked" image with the appropriate size to the clicked button. When the user clicks a button that is marked as checked using this approach, you can remove the image. Here's the code that you can use to achieve that:
function OnClientButtonClicked(sender, args) {
    var button = args.get_item();
    if (button.get_imageUrl() === "") {
        button.set_imageUrl("~/images/checked.png");
    }
    else {
        button.set_imageUrl("");
    }
}

Regards,
Ivan Danchev
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
0
Yenza
Top achievements
Rank 1
answered on 20 May 2015, 08:22 AM
This solved it for me :) Thanks!
Tags
DropDownList
Asked by
Yenza
Top achievements
Rank 1
Answers by
Yenza
Top achievements
Rank 1
Ivan Danchev
Telerik team
Share this question
or