This is a migrated thread and some comments may be shown as answers.

How to get custom attributes client side

1 Answer 171 Views
DropDownTree
This is a migrated thread and some comments may be shown as answers.
Dave
Top achievements
Rank 1
Dave asked on 02 Jul 2013, 04:58 PM
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.

1 Answer, 1 is accepted

Sort by
0
Kate
Telerik team
answered on 05 Jul 2013, 10:12 AM
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.
Tags
DropDownTree
Asked by
Dave
Top achievements
Rank 1
Answers by
Kate
Telerik team
Share this question
or