this is not a how to article.
i'm hoping that somebody searching and/or reading this post will have come across a fix for the following situation and can point me in the right direction.
On a test page I have an Ajax TabContainer with two Tab panels inside.
when the user clicks on the second tab, i'd like to dynamically create the content for the tab. The second tab may contain a substantial amount of data and i dont really want to hit up the browsers initial load on the first pass if theres a chance that the user may not even visit the second tab.
So heres what I've got so far:
Generated by this code:
1: <%@ Page Language="C#" AutoEventWireup="true" EnableViewState="false"
2: CodeFile="TabsTestPage.aspx.cs" Inherits="_testPages_TabsTestPage" %>
3:
4: <%@ Register Assembly="AjaxControlToolkit"
5: Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
6:
7: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
8: "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
9: <script runat="server">
10: [System.Web.Services.WebMethod]
11: [System.Web.Script.Services.ScriptMethod]
12: public static string GetHtml()
13: { 14:
15: return "<span style='font-family:courier new;
16: font-weight:bold;'>Dynamic Content Added!</span>";
17: }
18: </script>
19:
20: <script type="text/javascript">
21: function updatePanel()
22: { 23: var behavior = $find('dp1'); 24: if (behavior)
25: { 26: behavior.populate('changed'); 27: }
28: }
29:
30: function Tab2Clicked()
31: { 32: var panel2 = $get("TabContainer1_TabPanel2"); 33: panel2.innerHTML = "<div id=\"divDynamic\">
34: Dynamic Web Content Created!</div>";
35: }
36:
37: </script>
38: <html xmlns="http://www.w3.org/1999/xhtml" >
39: <head runat="server">
40: <title>Untitled Page</title>
41: </head>
42: <body>
43: <form id="form1" runat="server">
44: <div>
45: <asp:ScriptManager ID="ScriptManager1" runat="server">
46: </asp:ScriptManager>
47:
48: </div>
49: <cc1:TabContainer ID="TabContainer1" runat="server">
50: <cc1:TabPanel ID="TabPanel1" runat="server" >
51: <HeaderTemplate>Tab Panel 1</HeaderTemplate>
52: <ContentTemplate>Stuff Here</ContentTemplate>
53: </cc1:TabPanel>
54: <cc1:TabPanel ID="TabPanel2" runat="server"
55: OnClientClick="updatePanel" >
56: <HeaderTemplate>Tab Panel 2</HeaderTemplate>
57: </cc1:TabPanel>
58: </cc1:TabContainer>
59:
60: <cc1:DynamicPopulateExtender ID="dp"
61: BehaviorID="dp1" runat="server"
62: TargetControlID="Panel1"
63: ClearContentsDuringUpdate="true"
64: PopulateTriggerControlID=""
65: ServiceMethod="GetHtml"
66: />
67: <asp:Panel ID="Panel1" runat="server" />
68: </form>