[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Populating AJAX Control Toolkit tabs on page load

Posted on 2013-02-06
4
Medium Priority
?
594 Views
Last Modified: 2013-02-12
I'm trying to use the tab functionality provided through the AJAX Control Toolkit to show different views of data, which is being pulled through a WCF service from our database.  Because of some cross-domain issues, I need to access this service from the server side through C# rather than from the client side through Javascript.  As such, I'm trying to load this data during the page load event.  

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">
            <ContentTemplate>
                <div runat="server" id="_div1"></div>
            </ContentTemplate>
        </AJAXToolkit:TabPanel>

        <AJAXToolkit:TabPanel runat="server" ID="_tplView2" HeaderText="Tab 2">
            <ContentTemplate>
                <div runat="server" id="_div2"></div>
            </ContentTemplate>
        </AJAXToolkit:TabPanel>
    </AJAXToolkit:TabContainer>
</asp:Panel>

In page load, I'm building a table, which I'm then adding to the _div1 control:
System.Web.UI.Control selectedControl = FindControl(controlID);
selectedControl.Controls.Add(tbl);

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?
0
Comment
Question by:MSEC
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 16

Expert Comment

by:Steve Krile
ID: 38860135
A bit sideways to your question, but what about setting up a service on your site that handles the cross-domain problem - then call that service from the client side as you suggest at the beginning of your post that you'd prefer to do?
0
 

Author Comment

by:MSEC
ID: 38860212
Because I have to integrate with a third party vendor through this same service, the service uses XML & Ajax, rather than JSON.  As such, it's difficult to handle the cross-domain problem.
0
 

Accepted Solution

by:
MSEC earned 0 total points
ID: 38864512
I actually figured this out.  The problem wasn't that it was running on page load.  The problem was that the control was nested within other controls.  Here's how I had to change FindControl to make this work:
FindControl("tabContainer").FindControl("tab").FindControl("control");
0
 

Author Closing Comment

by:MSEC
ID: 38879453
I found the answer elsewhere.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We had a requirement to extract data from a SharePoint 2010 Customer List into a CSV file and then place the CSV file into a directory on the network so that the file could be consumed by an AS400 system. I will share in Part 1 how to Extract the Da…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question