Skip to content

Commit 852fbf8

Browse files
committed
Added How-to article "Accessing controls inside templates" for RadNavigation
1 parent 1278611 commit 852fbf8

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
title: Accessing Controls Inside Templates
3+
page_title: Accessing Controls Inside Templates | RadNavigation for ASP.NET AJAX Documentation
4+
description: Accessing Controls Inside Templates
5+
slug: navigation/templates/accessing-controls-inside-templates
6+
tags: accessing,controls,inside,templates
7+
published: True
8+
position: 2
9+
---
10+
11+
# Accessing Controls Inside Templates
12+
13+
14+
15+
The following example demonstrates how to find **RadDropDownList** control nested in a NodeTemplate of a **RadNavigation**.
16+
17+
Here follows the markup:
18+
19+
````ASPNET
20+
<telerik:RadNavigation runat="server" ID="RadNavigation1" Skin="Silk">
21+
<Nodes>
22+
<telerik:NavigationNode Text="Node with RadDropDownList">
23+
<NodeTemplate>
24+
<telerik:RadDropDownList ID="RadDropDownList1" runat="server"></telerik:RadDropDownList>
25+
</NodeTemplate>
26+
</telerik:NavigationNode>
27+
</Nodes>
28+
</telerik:RadNavigation>
29+
````
30+
31+
32+
33+
## How to find RadDropDownList object server-side
34+
35+
You need to search for the RadDropDownList in the Controls collection of the RadNavigation's nodes:
36+
37+
38+
39+
````C#
40+
41+
RadDropDownList dropDownList = (RadDropDownList)RadNavigation1.Nodes[0].FindControl("RadDropDownList1");
42+
43+
````
44+
````VB.NET
45+
46+
Dim dropDownList As RadDropDownList = DirectCast(RadNavigation1.Nodes(0).FindControl("RadDropDownList1"), RadDropDownList)
47+
48+
````
49+
50+
51+
## How to find RadDropDownList object client-side
52+
53+
Here are the available options to find the RadTreeView object in RadComboBox, on the client:
54+
55+
````JavaScript
56+
57+
var dropDownList = $find("<%= RadNavigation1.FindNodeByText("Node with RadDropDownList").FindControl("RadDropDownList1").ClientID %>");
58+
59+
````
60+
61+
62+

0 commit comments

Comments
 (0)