SplitButton by Value equivalent?

2 posts, 0 answers
  1. Joshua
    Joshua avatar
    78 posts
    Member since:
    Sep 2008

    Posted 19 Dec 2011 Link to this post

    In javascript, I'm using .findButtonByValue('value').

    However, how do I find a split button, especially since there's no 'value' property of the SplitButton?

    Thanks,
    Joshua
  2. Bozhidar
    Admin
    Bozhidar avatar
    1102 posts

    Posted 20 Dec 2011 Link to this post

    Hi Joshua,

    To get the split button, you can use the following approach:

    1. Set a custom attribute to the SplitButton. For example:

    <telerik:RibbonBarSplitButton SplitButtonValue="SplitButton1" Size="Medium" Text="Button" ImageUrl="~/Img.jpg" />

    2. Now you can find the button with the following function:
    function findSplitButton(buttonValue){
        var ribbon = $find("RadRibbonBar1");
        for (var i = 0; i < ribbon.get_tabs().get_count(); i++) {
            var tab =  ribbon.get_tabs().getTab(i);
            for (var j = 0; j < tab.get_groups().get_count(); j++) {
                var group = tab.get_groups().getGroup(j)
                for (var k = 0; k < group.get_items().get_count(); k++) {
                    var item = group.get_items().getItem(k);
                    var customAttribute = item.get_element().getAttribute('SplitButtonValue')
                    if(customAttribute != null && customAttribute == buttonValue){
                        alert(item.get_text());
                    }
                }
            }
        }
    }


    Regards,
    Bozhidar
    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