Populating AJAX Control Toolkit tabs on page load
Posted on 2013-02-06
Here is the asp.net code:
<asp:Panel runat="server" ID="_pnlMain">
<AJAXToolkit:TabContainer ID="_tabViewTabs" runat="server">
<AJAXToolkit:TabPanel runat="server" ID="_tplView1" HeaderText="Tab 1">
<div runat="server" id="_div1"></div>
<AJAXToolkit:TabPanel runat="server" ID="_tplView2" HeaderText="Tab 2">
<div runat="server" id="_div2"></div>
In page load, I'm building a table, which I'm then adding to the _div1 control:
System.Web.UI.Control selectedControl = FindControl(controlID);
However, whenever I try to access the _div1 component, I get a message saying that the control cannot be found. If I move the _div1 component outside of the tab container, I can access it just fine. I'm taking this to mean that the tab container elements haven't fully loaded at the time when I'm running the script, and that it therefore doesn't exist yet. The same thing happens if I try to run this code in the Pre-Render or Render methods. I also tried the Page.LoadComplete method, but this won't work because the code is inside a SharePoint User Control.
Is there any way to run this code after the AJAX tab container has already loaded?