determine itemtype client-side

2 posts, 0 answers
  1. Albert Shenker
    Albert Shenker avatar
    573 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
    Yana avatar
    4604 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";
            type = "splitbutton";
        return type;

    you can use it like this:

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

    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.
Back to Top