This is a migrated thread and some comments may be shown as answers.

error in accesing child controls inside RadDock

1 Answer 50 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Aby
Top achievements
Rank 1
Aby asked on 22 Jun 2008, 08:26 AM
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">
<ContentTemplate>
<asp:Label ID="lblEvents" runat="server"></asp:Label>
</ContentTemplate>
</telerik:RadDock>

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

Any help appreciated.
Thanks,
ABy

1 Answer, 1 is accepted

Sort by
0
Sophy
Telerik team
answered on 22 Jun 2008, 10:47 AM
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,
Sophy
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Dock
Asked by
Aby
Top achievements
Rank 1
Answers by
Sophy
Telerik team
Share this question
or