RadXmlHttpPanel won't work on RadTab__TabClick place.Controls.Add(LoadControl("c.ascx"))"

2 posts, 0 answers
  1. Chris Zavaleta
    Chris Zavaleta avatar
    10 posts
    Member since:
    Jul 2009

    Posted 29 Oct 2009 Link to this post

    WebUserControl1 has:
    <script type="text/javascript">
            function SetInterval()
            {
                var panel = $find("<%=RadXmlHttpPanel1.ClientID%>");
                panel.set_value("yes");
            }
        </script>
        <br />
        <input type="button" value="Start Timer" onclick="SetInterval()" />
    <telerik:RadXmlHttpPanel ID="RadXmlHttpPanel1" runat="server" LoadingPanelID="RadAjaxLoadingPanel1"
                OnServiceRequest="RadXmlHttpPanel1_ServiceRequest">
                <asp:Label ID="Label1" runat="server" Text="Timer Not Started"></asp:Label>
     </telerik:RadXmlHttpPanel>

    This works, from the Page_Load adding the control:
    protected void Page_Load(object sender, EventArgs e)
        {
               this.place.Controls.Add(LoadControl("WebUserControl1.ascx"));
        }

    This doesn't on a tab click adding the control and alerts "XmlHttpPanel Callback Loading error:
     Exception=The target 'ctl01$RadXmlHttpPanel1' for the callback could not be found or did not implement ICallbackEventHandler.":

    protected void Page_Load(object sender, EventArgs e)
     {
                grantTabs.TabClick += new RadTabStripEventHandler(grantTabs_TabClick);
     }

    void grantTabs_TabClick(object sender, RadTabStripEventArgs e)
    {
            this.place.Controls.Add(LoadControl("WebUserControl1.ascx"));
     }

    --------------------------------------------------------------------
    Just making the control load on the tab click stops the XmlHttpPanel from working.

    <telerik:RadTabStrip 
            runat="server" 
            ID="grantTabs" 
            Skin="Default">
            <Tabs>
                <telerik:RadTab runat="server" Text="Overview" PageViewID="overview" Selected="true" />
                <telerik:RadTab runat="server" Text="Activities" PageViewID="activities" />
              </Tabs>
        </telerik:RadTabStrip>
        <div class="tab_container">
            <asp:PlaceHolder ID="place" runat="server" />
            <div style="clear: both;">&nbsp;</div>
        </div>

    Is this a bug or is there a work around?
    Thanks

  2. Pero
    Admin
    Pero avatar
    1156 posts

    Posted 03 Nov 2009 Link to this post

    Hi Chris,

    This problem is not related to the RadXmlHttpPanel but expected behavior when ASP.NET client callbacks are used and controls are added dynamically to the page in events which are not run during the client callback. This means that the XmlHttpPanel will not be present on the page when you will try to initialize the client callback.

    Even though, in a client callback the page runs in a modified page life cycle - the page is initiated and its controls and other members are created (for more info read this MS help article). This means that the UserControl (and the RadXmlHttpPanel inside), added to the asp:PlaceHolder in the Click event of the TabStrip, will not be re-created when the XmlHttpPanel's client callback is in process and the target control for the client callback (i.e. the RadXmlHttpPanel) could not be found because it is not present (it wasn't recreated) on the page.

    This also explains the fact that everything is working fine when the UserControl is added to the page in the Page_Load event.   


    Kind regards,
    Pero
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top