How to get custom attributes client side

2 posts, 0 answers
  1. Dave
    Dave avatar
    38 posts
    Member since:
    Jul 2007

    Posted 02 Jul 2013 Link to this post

    I'm looking for a way to get the custom attributes of the DropDownTree on the client side. When I view the source, I can see the attributes,that i added from the server side, in the div tag of the control. How do I get those values? Is there a way to to pass custom attributes client side on an entry?

    Thanks.
  2. Kate
    Admin
    Kate avatar
    1898 posts

    Posted 05 Jul 2013 Link to this post

    Hi Dave,

    You can easily access the custom attribute of the RadDropDowntree control by using the following code snippet:
    <telerik:RadDropDownTree runat="server" ID="RadDropDownTree1" CheckBoxes="CheckChildNodes" Width="200px"
                   DataFieldID="ID" DefaultMessage="Select ..." DataFieldParentID="ParentID" DataTextField="Text" customAttribute="Customvalue">
                   <DropDownSettings AutoWidth="Enabled" CssClass="customCssClass" OpenDropDownOnLoad="true" />
               </telerik:RadDropDownTree>

    javascript:
    <script>
                   function OnClientClicking(sender, args) {
                       var tree = $find("RadDropDownTree1");
                       tree.get_element().getAttribute("customAttribute");
                  }
               </script>

    Regards,
    Kate
    Telerik
    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 the blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top