Access control inside RadDock from javascript

2 posts, 0 answers
  1. Serial Killer
    Serial Killer avatar
    8 posts
    Member since:
    Feb 2010

    Posted 25 Jan 2011 Link to this post

    Hello! I has faced such problem. I try to get access to control being inside RadDock using JavaScript. I do it as follows...

    <script type="text/javascript">

    var test = $find("<%=RadDock1.ContentContainer.FindControl("val1").ClientID %>");


     <telerik:RadDock ID="RadDock1" runat="server" Width="300px">

            <telerik:RadTextBox ID="val1" runat="server">


    When page generated, i cannot get access to control, and its "null" because if look html code i see the following...

    <span id="RadDock1_C_val1_wrapper" class="RadInput RadInput_Default" style="white-space:nowrap;">
    <input type="text" size="20" id="RadDock1_C_val1_text" name="RadDock1_C_val1_text" class="riTextBox riEnabled" style="width:125px;" />
    <input id="RadDock1_C_val1" name="RadDock1$C$val1" class="rdfd_" style="visibility:hidden;margin:-18px 0 0 -1px;width:1px;height:1px;overflow:hidden;border:0;padding:0;" type="text" value="" />
    <input id="RadDock1_C_val1_ClientState" name="RadDock1_C_val1_ClientState" type="hidden" /></span>
    And my javascript code - var test = $find("<%=RadDock1.ContentContainer.FindControl("val1").ClientID %>");
    find this control - RadDock1_C_val1 but it is null. How can i get access to this control - RadDock1_C_val1_text ??? what i do not so??

  2. Pero
    Pero avatar
    1156 posts

    Posted 26 Jan 2011 Link to this post


    I believe the problem comes from the fact that the RadDock's ContentTemplate is not initialized when you try to access some of its child controls, and that's why you can't get a reference to the RadTextBox. I would suggest to directly use the RadTextBox control, to get its client id.
    The following code works without a problem on my side:
    <script type="text/javascript">
        function pageLoad()
            var test = $find('<%=val1.ClientID %>');
    <telerik:RadDock ID="RadDock3" runat="server" Width="300px">
            <telerik:RadTextBox ID="val1" runat="server">

    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Back to Top