FindControl in NodeDataBound

4 posts, 0 answers
  1. Kevin Neumann
    Kevin Neumann avatar
    29 posts
    Member since:
    Feb 2006

    Posted 17 Dec 2011 Link to this post

    I am wondering if FindControl on the NodeDataBound is an upcoming feature? Or is it has been replaced with something else that I am missing?  I expected to be able to do e.Node.FindControl to find a control in my ItemTemplate but have not been able to do so yet.  A simple reasoning behind the need for this could be tied to the Soccer/Football example.  Say you wanted an image in the ItemTemplate of a Star that was only visible if the player was a team captain or something along that line.
  2. Peter Filipov
    Admin
    Peter Filipov avatar
    1028 posts

    Posted 21 Dec 2011 Link to this post

    Hi Kevin,

    For the next service pack the FindControl method of the GroupItem will be available. E.g. :

    void RadOrgChart5_GroupItemDataBound(object sender, Telerik.Web.UI.OrgChartGroupItemDataBoundEventArguments e)
    {
     
        var label = e.Item.FindControl("Label1")
    }

    The template is applied to the GroupItem,  that is why the find method is applied to it too.

    Greetings,
    Peter Filipov
    the Telerik team
    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 their blog feed now
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Sampath
    Sampath avatar
    12 posts
    Member since:
    Mar 2013

    Posted 02 Jun 2014 Link to this post

    Will the findcontrol method be available to NodeDataBound as well?
  5. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 02 Jun 2014 in reply to Sampath Link to this post

    Hi Sampath,

    Please try the following C# code snippet to access the ItemTemplate Control in OnNodeDataBound event of RadOrgChart.

    C#:
    Label lblControl = e.Node.GroupItems[0].FindControl("Label1") as Label;

    Thanks,
    Shinu.
Back to Top