I have the following aspx code in a usercontrol:
I dynamically create the Tabs and PageViews from the code behind on load. Inside the PageView is a RadTreeView. See code below:
I am trying to get a reference to the dynamically created RadTreeView. I have been unable to do so for some time now. Please help.
Thank you.
<
telerik:RadTabStrip
ID
=
"radTSCapabilities"
runat
=
"server"
SelectedIndex
=
"0"
Skin
=
"Default"
MultiPageID
=
"radMPCapabilities"
/>
<
telerik:RadMultiPage
ID
=
"radMPCapabilities"
runat
=
"server"
SelectedIndex
=
"0"
/>
I dynamically create the Tabs and PageViews from the code behind on load. Inside the PageView is a RadTreeView. See code below:
Telerik.Web.UI.RadPageView tmpPageView =
new
Telerik.Web.UI.RadPageView();
tmpPageView.ID = type.AbilityType.Name;
radMPCapabilities.PageViews.Add(tmpPageView);
//Add a Tab for the AbilityType
Telerik.Web.UI.RadTab tmpTab =
new
Telerik.Web.UI.RadTab(type.AbilityType.Name, type.AbilityType.ID.ToString());
tmpTab.PageViewID = tmpPageView.ID;
radTSCapabilities.Tabs.Add(tmpTab);
//Create and Load the Rad Tree
Telerik.Web.UI.RadTreeView radTree =
new
Telerik.Web.UI.RadTreeView();
radTree.Skin =
"Default"
;
radTree.CheckBoxes =
true
;
radTree.TriStateCheckBoxes =
true
;
radTree.CheckChildNodes =
true
;
radTree.NodeDataBound +=
new
Telerik.Web.UI.RadTreeViewEventHandler(radTree_NodeDataBound);
radTree.ID = type.AbilityType.ID.ToString() + type.AbilityType.Name.Replace(
" "
,
"_"
);
radTree.DataTextField =
"Name"
;
radTree.DataValueField =
"ID"
;
radTree.DataFieldID =
"ID"
;
radTree.DataFieldParentID =
"ParentID"
;
//If there are multiple Ability Types in result set then go to the DB to get all Abilities for that type
if
(distinctAbilityTypes.Count() != 1)
radTree.DataSource = AbilityMgr.GetAbilitiesByAbilityTypeID(type.AbilityType.ID);
else
radTree.DataSource = tmpAbilities;
//Bind the Tree
radTree.DataBind();
//Add a top border
Literal tmpLiteral =
new
Literal();
tmpLiteral.Text =
"<div style='border-top:solid 1px #AAAAAA;'></div>"
;
//Add the Literal and Tree to the associated PageView
radMPCapabilities.FindControl(type.AbilityType.Name).Controls.Add(tmpLiteral);
radMPCapabilities.FindControl(type.AbilityType.Name).Controls.Add(radTree);
I am trying to get a reference to the dynamically created RadTreeView. I have been unable to do so for some time now. Please help.
Thank you.