determine itemtype client-side

2 posts, 0 answers
  1. Albert Shenker
    Albert Shenker avatar
    550 posts
    Member since:
    Mar 2004

    Posted 18 Oct 2009 Link to this post

    I need to loop through the items in my toolbar client-side and set some specific properties if the item is a button and based upon it's "Group" property. When  I Ioop through, how do I first determine if the item is a RadToolbarButton (and therefore has the get_group method available? There doesn't seem to be a get_ItemType client-side method.
  2. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 21 Oct 2009 Link to this post

    Hi Albert,

    Please use the following javasctipt code in order to find the type of the button:

    function getItemType(button) {
        var type;
        var className = button.get_element().className;
        if (className.indexOf("rtbBtn") >= 0)
            type = "button";
        else if (className.indexOf("rtbDropDown") >= 0)
            type = "dropdown";
        else
            type = "splitbutton";
        return type;
    }

    you can use it like this:

    var toolbar = $find("<%=RadToolBar1.ClientID %>");
    var type = getItemType(toolbar.get_items().getItem(0));

    Regards,
    Yana
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top