RadToolBarButton with CheckOnClick

6 posts, 1 answers
  1. Yenza
    Yenza avatar
    10 posts
    Member since:
    Mar 2015

    Posted 27 Mar 2015 Link to this post

    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>
  2. Yenza
    Yenza avatar
    10 posts
    Member since:
    Mar 2015

    Posted 30 Mar 2015 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Ivan Danchev
    Admin
    Ivan Danchev avatar
    837 posts

    Posted 31 Mar 2015 Link to this post

    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.

     
  5. Yenza
    Yenza avatar
    10 posts
    Member since:
    Mar 2015

    Posted 01 Apr 2015 Link to this post

    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?
  6. Answer
    Ivan Danchev
    Admin
    Ivan Danchev avatar
    837 posts

    Posted 03 Apr 2015 Link to this post

    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.

     
  7. Yenza
    Yenza avatar
    10 posts
    Member since:
    Mar 2015

    Posted 20 May 2015 Link to this post

    This solved it for me :) Thanks!
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017