Find dynamically created Control

3 posts, 0 answers
  1. Chris Salas
    Chris Salas avatar
    46 posts
    Member since:
    Oct 2009

    Posted 16 Jan 2012 Link to this post

    I have the following aspx code in a usercontrol:

    <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;
    //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;
    //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);
        radTree.DataSource = tmpAbilities;
    //Bind the Tree
    //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

    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.
  2. Chris Salas
    Chris Salas avatar
    46 posts
    Member since:
    Oct 2009

    Posted 16 Jan 2012 Link to this post

    Sorry, I think this is in the wrong Forum, but maybe someone here can help me.
  3. Stefan
    Stefan avatar
    2911 posts

    Posted 17 Jan 2012 Link to this post

    Hi Chris,

    I am glad to see that you have found the right forum to address your question. Our colleagues there will help you out.

    the Telerik team

    SP1 of Q3’11 of RadControls for WinForms is available for download (see what's new).

Back to Top