error in accesing child controls inside RadDock

2 posts, 0 answers
  1. Aby
    Aby avatar
    5 posts
    Member since:
    Nov 2005

    Posted 22 Jun 2008 Link to this post

    I recently upgraded to prometheus, and my existing code which was working broke. Previously I used to access child controls inside raddock using code below

                Label Label1 = (Label)RadDock2.FindControl("lblEvents");
                Label1.Text = "my string here";

    ASP.NET code

    <telerik:RadDock ID="RadDock2" runat="server" Text="Events">
    <asp:Label ID="lblEvents" runat="server"></asp:Label>

    Now, its throwing System.NullReferenceException at Label1.Text = "my string here";

    Any help appreciated.
  2. Sophy
    Sophy avatar
    636 posts

    Posted 22 Jun 2008 Link to this post

    Hello Aby,

    In RadDock for ASP.NET you have direct access to the child controls of the RadDock placed inside dock's ContentTemplate. In your case you can access the label placed inside dock's ContentTemplate in the following way:
            lblEvents.Text = "my string here";

    or using the FindControl method to search the control inside the dock's ContentContainer, e.g.:
    Label Label1 = (Label)RadDock2.ContentContainer.FindControl("lblEvents");    
    Label1.Text = "my string here";
    Let us know if you need further assistance.

    Sincerely yours,
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Back to Top