473,703 Members | 2,660 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Asp.Net AJAX dynamically added Tab Control not displaying

I am trying to get to grips with the asp.net ajaxcontrol toolkit, and am
trying to add a tabbed control to the page.

I have no problems within the aspx file, and can dynamically manipulate a
tabcontainer which has 1 panel already, however I want to try create the
TabPanels dynamically. I followed the advice here:

http://www.asp.net/learn/ajax-videos/video-156.aspx (3rd comment - Joe
Stagner)

I am finding that the container is hidden.

I have found that I can work around this by creating the first tab within
the aspx, then performing RemoveAt(0) to remove that tab when I've added the
others. This works, but is not ideal as I can't add the original container
dynamically. Is there another way to do this, and what is the reason for
this behaviour?
Thanks,
Richard
My code is as follows:
aspx
<%@ Page Language="C#" AutoEventWireup ="true" CodeFile="Defau lt.aspx.cs"

Inherits="_Defa ult" %>

<%@ Register Assembly="AjaxC ontrolToolkit" Namespace="Ajax ControlToolkit"

TagPrefix="cc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">

<html xmlns="http://www.w3.org/1999/xhtml">

<head id="Head1" runat="server">

<title>Untitl ed Page</title>

</head>

<body>

<form id="form1" runat="server">

<div>

<asp:ScriptMana ger ID="ScriptManag er1" runat="server">

</asp:ScriptManag er>


<cc1:TabContain er ID="tc1" runat="server" >

<cc1:TabPanel runat="server" HeaderText="Tab Panel1" ID="TabPanel1" >

<ContentTemplat e>This is the content - </ContentTemplate >

</cc1:TabPanel></cc1:TabContaine r>

</div>

<div>

<cc1:TabContain er ID="tc2" runat="server">
</cc1:TabContaine r>

</div>

</form>

</body>

</html>

aspx.cs

using System;

using System.Configur ation;

using System.Data;

using System.Linq;

using System.Web;

using System.Web.Secu rity;

using System.Web.UI;

using System.Web.UI.H tmlControls;

using System.Web.UI.W ebControls;

using System.Web.UI.W ebControls.WebP arts;

using System.Xml.Linq ;

using AjaxControlTool kit;

public partial class _Default : System.Web.UI.P age

{

protected void Page_Init(objec t sender, EventArgs e)

{

this.tc1.Tabs[0].Controls.Add(n ew LiteralControl( "I can add content to an
existing panel"));

TabPanel panel = new TabPanel();

panel.HeaderTex t = "tab2";

panel.Controls. Add(new LiteralControl( "I can even add a new panel to a
container which already has a panel"));

this.tc1.Tabs.A dd(panel);

TabPanel[] newpanels = new TabPanel[3];

for (int iCnt = 0; iCnt < 3; iCnt++)

{

newpanels[iCnt] = new TabPanel();

newpanels[iCnt].HeaderText = String.Concat(" New Panel" + iCnt);

newpanels[iCnt].Controls.Add(n ew LiteralControl( "But I can't add new
panels"));

this.tc2.Tabs.A dd(newpanels[iCnt]);

}
}


}

The source of the resultant page is below(note that the dynamically added
tags are styled as "display:no ne; visibility:hidd en"):
<div class="ajax__ta b_xp" id="tc1" style="visibili ty:hidden;">
<div id="tc1_header" >
<span id="__tab_tc1_T abPanel1">TabPa nel1</span><span
id="__tab_tc1_c tl00">tab2</span>
</div><div id="tc1_body">
<div id="tc1_TabPane l1">
This is the content - I can add content to an existing panel
</div><div id="tc1_ctl00" style="display: none;visibility :hidden;">
I can even add a new panel to a container which already has a panel
</div>
</div>
</div>
</div>
<div>
<div class="ajax__ta b_xp" id="tc2" style="visibili ty:hidden;">
<div id="tc2_header" >
<span id="__tab_tc2_c tl00">New Panel0</span><span id="__tab_tc2_c tl01">New
Panel1</span><span id="__tab_tc2_c tl02">New Panel2</span>
</div><div id="tc2_body">
<div id="tc2_ctl00" style="display: none;visibility :hidden;">
But I can't add new panels
</div><div id="tc2_ctl01" style="display: none;visibility :hidden;">
But I can't add new panels
</div><div id="tc2_ctl02" style="display: none;visibility :hidden;">
But I can't add new panels
</div>
</div>
</div>
</div>

Oct 7 '08 #1
7 6656
Hi Richard,

Please try to use Page_PreInit instead of Page_Init.

The OnInit of TabContainer fires earlier than the Page_Init. Thus, if we
add controls in the Page_Init the TabPanels will not be shown.

Please have a look at the source code of the TabContainer control:
protected override void OnInit(EventArg s e)
{
base.OnInit(e);
this.Page.Regis terRequiresCont rolState(this);
this._initializ ed = true;
if (this._cachedAc tiveTabIndex -1)
{
this.ActiveTabI ndex = this._cachedAct iveTabIndex;
}
else if (this.Tabs.Coun t 0)
{
this.ActiveTabI ndex = 0;
}
}

We can see if there's no tabs added in the TabContainer the ActiveTabIndex
will not be assigned 0. And The default value of the ActiveTabIndex is -1.
On the render stage, TabContainer will check the ActiveTabIndex. If it's -1
then definitely no tab will be shown.

Please have a try and let me know if it works.
Regards,
Allen Chen
Microsoft Online Community Support
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsof t.com.

=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subs...#notifications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://support.microsoft.com/select/...tance&ln=en-us.
=============== =============== =============== =====
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
| From: "RichB" <ri**********@c ommunity.nospam >
| Subject: Asp.Net AJAX dynamically added Tab Control not displaying
| Date: Tue, 7 Oct 2008 17:01:41 +0100
| Lines: 204
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
| X-RFC2646: Format=Flowed; Original
| Message-ID: <ub************ **@TK2MSFTNGP06 .phx.gbl>
| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| NNTP-Posting-Host: 93-96-97-68.zone4.bether e.co.uk 93.96.97.68
| Path: TK2MSFTNGHUB02. phx.gbl!TK2MSFT NGP01.phx.gbl!T K2MSFTNGP06.phx .gbl
| Xref: TK2MSFTNGHUB02. phx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:7745 7
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
|
| I am trying to get to grips with the asp.net ajaxcontrol toolkit, and am
| trying to add a tabbed control to the page.
|
| I have no problems within the aspx file, and can dynamically manipulate a
| tabcontainer which has 1 panel already, however I want to try create the
| TabPanels dynamically. I followed the advice here:
|
| http://www.asp.net/learn/ajax-videos/video-156.aspx (3rd comment - Joe
| Stagner)
|
| I am finding that the container is hidden.
|
| I have found that I can work around this by creating the first tab within
| the aspx, then performing RemoveAt(0) to remove that tab when I've added
the
| others. This works, but is not ideal as I can't add the original
container
| dynamically. Is there another way to do this, and what is the reason for
| this behaviour?
|
|
| Thanks,
| Richard
|
|
| My code is as follows:
| aspx
| <%@ Page Language="C#" AutoEventWireup ="true" CodeFile="Defau lt.aspx.cs"
|
| Inherits="_Defa ult" %>
|
| <%@ Register Assembly="AjaxC ontrolToolkit" Namespace="Ajax ControlToolkit"
|
| TagPrefix="cc1" %>
|
|
|
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
| "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
|
| <html xmlns="http://www.w3.org/1999/xhtml">
|
| <head id="Head1" runat="server">
|
| <title>Untitl ed Page</title>
|
| </head>
|
| <body>
|
| <form id="form1" runat="server">
|
| <div>
|
| <asp:ScriptMana ger ID="ScriptManag er1" runat="server">
|
| </asp:ScriptManag er>
|
|
|
|
| <cc1:TabContain er ID="tc1" runat="server" >
|
| <cc1:TabPanel runat="server" HeaderText="Tab Panel1" ID="TabPanel1" >
|
| <ContentTemplat e>This is the content - </ContentTemplate >
|
| </cc1:TabPanel></cc1:TabContaine r>
|
| </div>
|
|
|
| <div>
|
| <cc1:TabContain er ID="tc2" runat="server">
|
|
| </cc1:TabContaine r>
|
| </div>
|
|
|
| </form>
|
| </body>
|
| </html>
|
|
|
| aspx.cs
|
| using System;
|
| using System.Configur ation;
|
| using System.Data;
|
| using System.Linq;
|
| using System.Web;
|
| using System.Web.Secu rity;
|
| using System.Web.UI;
|
| using System.Web.UI.H tmlControls;
|
| using System.Web.UI.W ebControls;
|
| using System.Web.UI.W ebControls.WebP arts;
|
| using System.Xml.Linq ;
|
| using AjaxControlTool kit;
|
| public partial class _Default : System.Web.UI.P age
|
| {
|
| protected void Page_Init(objec t sender, EventArgs e)
|
| {
|
| this.tc1.Tabs[0].Controls.Add(n ew LiteralControl( "I can add content to an
| existing panel"));
|
| TabPanel panel = new TabPanel();
|
| panel.HeaderTex t = "tab2";
|
| panel.Controls. Add(new LiteralControl( "I can even add a new panel to a
| container which already has a panel"));
|
| this.tc1.Tabs.A dd(panel);
|
| TabPanel[] newpanels = new TabPanel[3];
|
| for (int iCnt = 0; iCnt < 3; iCnt++)
|
| {
|
| newpanels[iCnt] = new TabPanel();
|
| newpanels[iCnt].HeaderText = String.Concat(" New Panel" + iCnt);
|
| newpanels[iCnt].Controls.Add(n ew LiteralControl( "But I can't add new
| panels"));
|
| this.tc2.Tabs.A dd(newpanels[iCnt]);
|
| }
|
|
| }
|
|
|
|
| }
|
|
|
|
|
| The source of the resultant page is below(note that the dynamically added
| tags are styled as "display:no ne; visibility:hidd en"):
| <div class="ajax__ta b_xp" id="tc1" style="visibili ty:hidden;">
| <div id="tc1_header" >
| <span id="__tab_tc1_T abPanel1">TabPa nel1</span><span
| id="__tab_tc1_c tl00">tab2</span>
| </div><div id="tc1_body">
| <div id="tc1_TabPane l1">
| This is the content - I can add content to an existing panel
| </div><div id="tc1_ctl00" style="display: none;visibility :hidden;">
| I can even add a new panel to a container which already has a panel
| </div>
| </div>
| </div>
| </div>
|
|
| <div>
| <div class="ajax__ta b_xp" id="tc2" style="visibili ty:hidden;">
| <div id="tc2_header" >
| <span id="__tab_tc2_c tl00">New Panel0</span><span
id="__tab_tc2_c tl01">New
| Panel1</span><span id="__tab_tc2_c tl02">New Panel2</span>
| </div><div id="tc2_body">
| <div id="tc2_ctl00" style="display: none;visibility :hidden;">
| But I can't add new panels
| </div><div id="tc2_ctl01" style="display: none;visibility :hidden;">
| But I can't add new panels
| </div><div id="tc2_ctl02" style="display: none;visibility :hidden;">
| But I can't add new panels
| </div>
| </div>
| </div>
| </div>
|
|
|
|
|
|

Oct 8 '08 #2
Allen thanks again,

I am slowly getting to grips with the lifecycle, but would never have picked
this up. I do actually have the source for the ajaxtoolkit, but if I had
just downloaded the dlls then is trying each of the delegate methods for the
lifecycle the only way that I could have established this? or is the mere
presence of the OnInit override an indication that content should be added
PreInit.

I assume however that it is also true, some actions cannot be taken until
after a lifecycle event has occured, though I would appreciate it if you
could point me at some decumentation with examples which illustrates this
point.

My final aim is to add the control within the Accordion custom control that
you helped me with previously. I have tried to do this today, by including a
tab panel within the ContentUserCont rol. Although I have the Accordion
control constructed at Page_PreInit within the aspx file, the Tabbed Panels
within the TabContainer within the CustomUserCOntr ol are not being added.

What is happening in this case? My code extracts are below.

If you can recomend some documents/books which I can read around the subject
of page life cycle I would appreciate it. Although I think I understand the
stages of the lifecyle, I don't seem to have a full understanding of the
lifecyle where custom/user controls are involved.

Thanks,
Richard

ContentUserCont rol.ascx.cs
<%@ Control Language="C#" AutoEventWireup ="true"

CodeFile="Conte ntUserControl.a scx.cs"
Inherits="Accor dionTest.Conten tUserControl" %>

<%@ Register Assembly="AjaxC ontrolToolkit" Namespace="Ajax ControlToolkit"

TagPrefix="cc1" %>

<cc1:TabContain er runat="server" ID = "tc1"><cc1:TabP anel
HeaderText="0"> <ContentTemplat e>fist tab</ContentTemplate ></cc1:TabPanel>

<cc1:TabPanel HeaderText="1"> <ContentTemplat e>is the second
tab</ContentTemplate </cc1:TabPanel></cc1:TabContaine r>

<asp:Button ID="Button1" runat="server" Text="Button" onload="Button1 _Load"

/>
Browser Source:
<div id="Accordion1" >
<input type="hidden" name="Accordion 1_AccordionExte nder_ClientStat e"
id="Accordion1_ AccordionExtend er_ClientState" /><div>
<div style="backgrou nd-color:Gray;">
<span id="ctl07_ctl01 _Label1">Header Test_96</span>
</div>
</div><div style="display: block;">
<div class="ajax__ta b_xp" id="ctl08_ctl00 _tc1" style="visibili ty:hidden;">
<div id="ctl08_ctl00 _tc1_header">

</div><div id="ctl08_ctl00 _tc1_body">

</div>
</div>

<input type="submit" name="ctl08$ctl 00$Button1" value="ContentT est_96"
id="ctl08_ctl00 _Button1" />

</div>

"Allen Chen [MSFT]" <v-******@online.m icrosoft.comwro te in message
news:Uo******** ******@TK2MSFTN GHUB02.phx.gbl. ..
Hi Richard,

Please try to use Page_PreInit instead of Page_Init.

The OnInit of TabContainer fires earlier than the Page_Init. Thus, if we
add controls in the Page_Init the TabPanels will not be shown.

Please have a look at the source code of the TabContainer control:
protected override void OnInit(EventArg s e)
{
base.OnInit(e);
this.Page.Regis terRequiresCont rolState(this);
this._initializ ed = true;
if (this._cachedAc tiveTabIndex -1)
{
this.ActiveTabI ndex = this._cachedAct iveTabIndex;
}
else if (this.Tabs.Coun t 0)
{
this.ActiveTabI ndex = 0;
}
}

We can see if there's no tabs added in the TabContainer the ActiveTabIndex
will not be assigned 0. And The default value of the ActiveTabIndex is -1.
On the render stage, TabContainer will check the ActiveTabIndex. If
it's -1
then definitely no tab will be shown.

Please have a try and let me know if it works.
Regards,
Allen Chen
Microsoft Online Community Support
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsof t.com.

=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subs...#notifications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://support.microsoft.com/select/...tance&ln=en-us.
=============== =============== =============== =====
This posting is provided "AS IS" with no warranties, and confers no
rights.

--------------------
| From: "RichB" <ri**********@c ommunity.nospam >
| Subject: Asp.Net AJAX dynamically added Tab Control not displaying
| Date: Tue, 7 Oct 2008 17:01:41 +0100
| Lines: 204
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
| X-RFC2646: Format=Flowed; Original
| Message-ID: <ub************ **@TK2MSFTNGP06 .phx.gbl>
| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| NNTP-Posting-Host: 93-96-97-68.zone4.bether e.co.uk 93.96.97.68
| Path: TK2MSFTNGHUB02. phx.gbl!TK2MSFT NGP01.phx.gbl!T K2MSFTNGP06.phx .gbl
| Xref: TK2MSFTNGHUB02. phx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:7745 7
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
|
| I am trying to get to grips with the asp.net ajaxcontrol toolkit, and am
| trying to add a tabbed control to the page.
|
| I have no problems within the aspx file, and can dynamically manipulate
a
| tabcontainer which has 1 panel already, however I want to try create the
| TabPanels dynamically. I followed the advice here:
|
| http://www.asp.net/learn/ajax-videos/video-156.aspx (3rd comment - Joe
| Stagner)
|
| I am finding that the container is hidden.
|
| I have found that I can work around this by creating the first tab
within
| the aspx, then performing RemoveAt(0) to remove that tab when I've added
the
| others. This works, but is not ideal as I can't add the original
container
| dynamically. Is there another way to do this, and what is the reason for
| this behaviour?
|
|
| Thanks,
| Richard
|
|
| My code is as follows:
| aspx
| <%@ Page Language="C#" AutoEventWireup ="true" CodeFile="Defau lt.aspx.cs"
|
| Inherits="_Defa ult" %>
|
| <%@ Register Assembly="AjaxC ontrolToolkit"
Namespace="Ajax ControlToolkit"
|
| TagPrefix="cc1" %>
|
|
|
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
| "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
|
| <html xmlns="http://www.w3.org/1999/xhtml">
|
| <head id="Head1" runat="server">
|
| <title>Untitl ed Page</title>
|
| </head>
|
| <body>
|
| <form id="form1" runat="server">
|
| <div>
|
| <asp:ScriptMana ger ID="ScriptManag er1" runat="server">
|
| </asp:ScriptManag er>
|
|
|
|
| <cc1:TabContain er ID="tc1" runat="server" >
|
| <cc1:TabPanel runat="server" HeaderText="Tab Panel1" ID="TabPanel1" >
|
| <ContentTemplat e>This is the content - </ContentTemplate >
|
| </cc1:TabPanel></cc1:TabContaine r>
|
| </div>
|
|
|
| <div>
|
| <cc1:TabContain er ID="tc2" runat="server">
|
|
| </cc1:TabContaine r>
|
| </div>
|
|
|
| </form>
|
| </body>
|
| </html>
|
|
|
| aspx.cs
|
| using System;
|
| using System.Configur ation;
|
| using System.Data;
|
| using System.Linq;
|
| using System.Web;
|
| using System.Web.Secu rity;
|
| using System.Web.UI;
|
| using System.Web.UI.H tmlControls;
|
| using System.Web.UI.W ebControls;
|
| using System.Web.UI.W ebControls.WebP arts;
|
| using System.Xml.Linq ;
|
| using AjaxControlTool kit;
|
| public partial class _Default : System.Web.UI.P age
|
| {
|
| protected void Page_Init(objec t sender, EventArgs e)
|
| {
|
| this.tc1.Tabs[0].Controls.Add(n ew LiteralControl( "I can add content to
an
| existing panel"));
|
| TabPanel panel = new TabPanel();
|
| panel.HeaderTex t = "tab2";
|
| panel.Controls. Add(new LiteralControl( "I can even add a new panel to a
| container which already has a panel"));
|
| this.tc1.Tabs.A dd(panel);
|
| TabPanel[] newpanels = new TabPanel[3];
|
| for (int iCnt = 0; iCnt < 3; iCnt++)
|
| {
|
| newpanels[iCnt] = new TabPanel();
|
| newpanels[iCnt].HeaderText = String.Concat(" New Panel" + iCnt);
|
| newpanels[iCnt].Controls.Add(n ew LiteralControl( "But I can't add new
| panels"));
|
| this.tc2.Tabs.A dd(newpanels[iCnt]);
|
| }
|
|
| }
|
|
|
|
| }
|
|
|
|
|
| The source of the resultant page is below(note that the dynamically
added
| tags are styled as "display:no ne; visibility:hidd en"):
| <div class="ajax__ta b_xp" id="tc1" style="visibili ty:hidden;">
| <div id="tc1_header" >
| <span id="__tab_tc1_T abPanel1">TabPa nel1</span><span
| id="__tab_tc1_c tl00">tab2</span>
| </div><div id="tc1_body">
| <div id="tc1_TabPane l1">
| This is the content - I can add content to an existing panel
| </div><div id="tc1_ctl00" style="display: none;visibility :hidden;">
| I can even add a new panel to a container which already has a panel
| </div>
| </div>
| </div>
| </div>
|
|
| <div>
| <div class="ajax__ta b_xp" id="tc2" style="visibili ty:hidden;">
| <div id="tc2_header" >
| <span id="__tab_tc2_c tl00">New Panel0</span><span
id="__tab_tc2_c tl01">New
| Panel1</span><span id="__tab_tc2_c tl02">New Panel2</span>
| </div><div id="tc2_body">
| <div id="tc2_ctl00" style="display: none;visibility :hidden;">
| But I can't add new panels
| </div><div id="tc2_ctl01" style="display: none;visibility :hidden;">
| But I can't add new panels
| </div><div id="tc2_ctl02" style="display: none;visibility :hidden;">
| But I can't add new panels
| </div>
| </div>
| </div>
| </div>
|
|
|
|
|
|


Oct 9 '08 #3
Hi Richard,

This issue, as I said, is due to the sequence of the execution of the code.
I'll try to rephrase.

protected override void OnInit(EventArg s e)
{
base.OnInit(e);
this.Page.Regis terRequiresCont rolState(this);
this._initializ ed = true;
if (this._cachedAc tiveTabIndex -1)
{
this.ActiveTabI ndex = this._cachedAct iveTabIndex;
}
else if (this.Tabs.Coun t 0)
{
this.ActiveTabI ndex = 0;
}
}

Please pay attention to following code:
else if (this.Tabs.Coun t 0)
{
this.ActiveTabI ndex = 0;
}

It means if there's no tab added in the TabContainer this.ActiveTabI ndex=0
will not be executed. It's reasonable. However, the Init of the Controls
that are added in the aspx fires earlier than the Page's Init. So the
result is, the TabContainer's ActiveTabIndex is -1 (it's default value that
is set in its constructor method). Then the code to add the TabPanels fires
(but it DOES NOT change the ActiveTabIndex of TabContainer). On the render
stage, the TabPanel checks the ActiveTabIndex. Since it's now -1 the
TabPanel assumes there's no active tab and it hides all the tabs at client
side.
So, to solve this issue, we have two options, obviously:

1. As I mentioned, add the TabPanels on an earlier stage than the
TabContainer's Init. The Page's PreInit is probably a good choice.

2. Set the ActiveTabIndex manually after the TabPanel has been added
(following sample is for the code in your first post):
protected void Page_PreRender( object sender, EventArgs e)
{
this.tc2.Active TabIndex = 0; //Manually set the active tab index.
}

protected void Page_Init(objec t sender, EventArgs e)//Or just use
Page_PreInit so that we don't have to manually set the active tab index.

{

this.tc1.Tabs[0].Controls.Add(n ew LiteralControl( "I can add content to an
existing panel"));

TabPanel panel = new TabPanel();

panel.HeaderTex t = "tab2";

panel.Controls. Add(new LiteralControl( "I can even add a new panel to a
container which already has a panel"));

this.tc1.Tabs.A dd(panel);

TabPanel[] newpanels = new TabPanel[3];

for (int iCnt = 0; iCnt < 3; iCnt++)

{

newpanels[iCnt] = new TabPanel();

newpanels[iCnt].HeaderText = String.Concat(" New Panel" + iCnt);

newpanels[iCnt].Controls.Add(n ew LiteralControl( "But I can't add new
panels"));

this.tc2.Tabs.A dd(newpanels[iCnt]);

}
}

As to your current scenario I think you can use the second option because
you're using the usercontrol and it'll generally involve some page life
cycle issues if we choose the event incautiously.

I understand you want to learn more about the page life cycle. But I
haven't found any book that is targeted to this topic.

I would like to tell you how I learn the page life cycle myself. Basically
I have two options:

1. Use the Reflector:
http://www.red-gate.com/products/reflector/index.htm
This response contains a reference to a third party World Wide Web site.
Microsoft is providing this information as a convenience to you. Microsoft
does not control these sites and has not tested any software or information
found on these sites; therefore, Microsoft cannot make any representations
regarding the quality, safety, or suitability of any software or
information found there. There are inherent dangers in the use of any
software found on the Internet, and Microsoft cautions you to make sure
that you completely understand the risk before retrieving any software from
the Internet.

Open the reflector, find the Page class and it's method:

private void ProcessRequestM ain(bool includeStagesBe foreAsyncPoint, bool
includeStagesAf terAsyncPoint)

Then you can go on your way to track the page life cycle.

2. Debug the ASP.NET source code:
http://blogs.msdn.com/sburke/archive...sual-studio-to
-debug-net-framework-source-code.aspx

The advantage of this option is, we can set breakpoints.

In addition, there's a Page Life Cycle methods list in this documentation:
http://msdn.microsoft.com/en-us/libr...81(VS.80).aspx

Please have a try and let me know if you need further assistance. If it
still doesn't work please send a demo project to me. My email is
v-******@microsof t.com.

Regards,
Allen Chen
Microsoft Online Support

--------------------
| From: "RichB" <ri**********@c ommunity.nospam >
| References: <ub************ **@TK2MSFTNGP06 .phx.gbl>
<Uo************ **@TK2MSFTNGHUB 02.phx.gbl>
| Subject: Re: Asp.Net AJAX dynamically added Tab Control not displaying
| Date: Thu, 9 Oct 2008 14:33:45 +0100
| Lines: 371
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
| X-RFC2646: Format=Flowed; Original
| Message-ID: <uu************ **@TK2MSFTNGP02 .phx.gbl>
| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| NNTP-Posting-Host: 93-96-97-68.zone4.bether e.co.uk 93.96.97.68
| Path: TK2MSFTNGHUB02. phx.gbl!TK2MSFT NGP01.phx.gbl!T K2MSFTNGP02.phx .gbl
| Xref: TK2MSFTNGHUB02. phx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:7759 1
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
|
| Allen thanks again,
|
| I am slowly getting to grips with the lifecycle, but would never have
picked
| this up. I do actually have the source for the ajaxtoolkit, but if I had
| just downloaded the dlls then is trying each of the delegate methods for
the
| lifecycle the only way that I could have established this? or is the mere
| presence of the OnInit override an indication that content should be
added
| PreInit.
|
| I assume however that it is also true, some actions cannot be taken until
| after a lifecycle event has occured, though I would appreciate it if you
| could point me at some decumentation with examples which illustrates this
| point.
|
| My final aim is to add the control within the Accordion custom control
that
| you helped me with previously. I have tried to do this today, by
including a
| tab panel within the ContentUserCont rol. Although I have the Accordion
| control constructed at Page_PreInit within the aspx file, the Tabbed
Panels
| within the TabContainer within the CustomUserCOntr ol are not being added.
|
| What is happening in this case? My code extracts are below.
|
| If you can recomend some documents/books which I can read around the
subject
| of page life cycle I would appreciate it. Although I think I understand
the
| stages of the lifecyle, I don't seem to have a full understanding of the
| lifecyle where custom/user controls are involved.
|
| Thanks,
| Richard
|
| ContentUserCont rol.ascx.cs
| <%@ Control Language="C#" AutoEventWireup ="true"
|
| CodeFile="Conte ntUserControl.a scx.cs"
| Inherits="Accor dionTest.Conten tUserControl" %>
|
| <%@ Register Assembly="AjaxC ontrolToolkit" Namespace="Ajax ControlToolkit"
|
| TagPrefix="cc1" %>
|
|
|
| <cc1:TabContain er runat="server" ID = "tc1"><cc1:TabP anel
| HeaderText="0"> <ContentTemplat e>fist tab</ContentTemplate ></cc1:TabPanel>
|
| <cc1:TabPanel HeaderText="1"> <ContentTemplat e>is the second
| tab</ContentTemplate </cc1:TabPanel></cc1:TabContaine r>
|
| <asp:Button ID="Button1" runat="server" Text="Button"
onload="Button1 _Load"
|
| />
|
|
| Browser Source:
| <div id="Accordion1" >
| <input type="hidden" name="Accordion 1_AccordionExte nder_ClientStat e"
| id="Accordion1_ AccordionExtend er_ClientState" /><div>
| <div style="backgrou nd-color:Gray;">
| <span id="ctl07_ctl01 _Label1">Header Test_96</span>
| </div>
| </div><div style="display: block;">
| <div class="ajax__ta b_xp" id="ctl08_ctl00 _tc1"
style="visibili ty:hidden;">
| <div id="ctl08_ctl00 _tc1_header">
|
| </div><div id="ctl08_ctl00 _tc1_body">
|
| </div>
| </div>
|
| <input type="submit" name="ctl08$ctl 00$Button1" value="ContentT est_96"
| id="ctl08_ctl00 _Button1" />
|
| </div>
|
| "Allen Chen [MSFT]" <v-******@online.m icrosoft.comwro te in message
| news:Uo******** ******@TK2MSFTN GHUB02.phx.gbl. ..
| Hi Richard,
| >
| Please try to use Page_PreInit instead of Page_Init.
| >
| The OnInit of TabContainer fires earlier than the Page_Init. Thus, if we
| add controls in the Page_Init the TabPanels will not be shown.
| >
| Please have a look at the source code of the TabContainer control:
| protected override void OnInit(EventArg s e)
| {
| base.OnInit(e);
| this.Page.Regis terRequiresCont rolState(this);
| this._initializ ed = true;
| if (this._cachedAc tiveTabIndex -1)
| {
| this.ActiveTabI ndex = this._cachedAct iveTabIndex;
| }
| else if (this.Tabs.Coun t 0)
| {
| this.ActiveTabI ndex = 0;
| }
| }
| >
| We can see if there's no tabs added in the TabContainer the
ActiveTabIndex
| will not be assigned 0. And The default value of the ActiveTabIndex is
-1.
| On the render stage, TabContainer will check the ActiveTabIndex. If
| it's -1
| then definitely no tab will be shown.
| >
| Please have a try and let me know if it works.
| Regards,
| Allen Chen
| Microsoft Online Community Support
| >
| >
| Delighting our customers is our #1 priority. We welcome your comments
and
| suggestions about how we can improve the support we provide to you.
Please
| feel free to let my manager know what you think of the level of service
| provided. You can send feedback directly to my manager at:
| ms****@microsof t.com.
| >
| =============== =============== =============== =====
| Get notification to my posts through email? Please refer to
| >
http://msdn.microsoft.com/en-us/subs...#notifications.
| >
| Note: The MSDN Managed Newsgroup support offering is for non-urgent
issues
| where an initial response from the community or a Microsoft Support
| Engineer within 1 business day is acceptable. Please note that each
follow
| up response may take approximately 2 business days as the support
| professional working with you may need further investigation to reach
the
| most efficient resolution. The offering is not appropriate for
situations
| that require urgent, real-time or phone-based interactions or complex
| project analysis and dump analysis issues. Issues of this nature are
best
| handled working with a dedicated Microsoft Support Engineer by
contacting
| Microsoft Customer Support Services (CSS) at
| >
http://support.microsoft.com/select/...tance&ln=en-us.
| =============== =============== =============== =====
| This posting is provided "AS IS" with no warranties, and confers no
| rights.
| >
| --------------------
| | From: "RichB" <ri**********@c ommunity.nospam >
| | Subject: Asp.Net AJAX dynamically added Tab Control not displaying
| | Date: Tue, 7 Oct 2008 17:01:41 +0100
| | Lines: 204
| | X-Priority: 3
| | X-MSMail-Priority: Normal
| | X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
| | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
| | X-RFC2646: Format=Flowed; Original
| | Message-ID: <ub************ **@TK2MSFTNGP06 .phx.gbl>
| | Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| | NNTP-Posting-Host: 93-96-97-68.zone4.bether e.co.uk 93.96.97.68
| | Path: TK2MSFTNGHUB02. phx.gbl!TK2MSFT NGP01.phx.gbl!T K2MSFTNGP06.phx .gbl
| | Xref: TK2MSFTNGHUB02. phx.gbl
| microsoft.publi c.dotnet.framew ork.aspnet:7745 7
| | X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
| |
| | I am trying to get to grips with the asp.net ajaxcontrol toolkit, and
am
| | trying to add a tabbed control to the page.
| |
| | I have no problems within the aspx file, and can dynamically
manipulate
| a
| | tabcontainer which has 1 panel already, however I want to try create
the
| | TabPanels dynamically. I followed the advice here:
| |
| | http://www.asp.net/learn/ajax-videos/video-156.aspx (3rd comment - Joe
| | Stagner)
| |
| | I am finding that the container is hidden.
| |
| | I have found that I can work around this by creating the first tab
| within
| | the aspx, then performing RemoveAt(0) to remove that tab when I've
added
| the
| | others. This works, but is not ideal as I can't add the original
| container
| | dynamically. Is there another way to do this, and what is the reason
for
| | this behaviour?
| |
| |
| | Thanks,
| | Richard
| |
| |
| | My code is as follows:
| | aspx
| | <%@ Page Language="C#" AutoEventWireup ="true"
CodeFile="Defau lt.aspx.cs"
| |
| | Inherits="_Defa ult" %>
| |
| | <%@ Register Assembly="AjaxC ontrolToolkit"
| Namespace="Ajax ControlToolkit"
| |
| | TagPrefix="cc1" %>
| |
| |
| |
| | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
| |
| | "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
| |
| | <html xmlns="http://www.w3.org/1999/xhtml">
| |
| | <head id="Head1" runat="server">
| |
| | <title>Untitl ed Page</title>
| |
| | </head>
| |
| | <body>
| |
| | <form id="form1" runat="server">
| |
| | <div>
| |
| | <asp:ScriptMana ger ID="ScriptManag er1" runat="server">
| |
| | </asp:ScriptManag er>
| |
| |
| |
| |
| | <cc1:TabContain er ID="tc1" runat="server" >
| |
| | <cc1:TabPanel runat="server" HeaderText="Tab Panel1" ID="TabPanel1" >
| |
| | <ContentTemplat e>This is the content - </ContentTemplate >
| |
| | </cc1:TabPanel></cc1:TabContaine r>
| |
| | </div>
| |
| |
| |
| | <div>
| |
| | <cc1:TabContain er ID="tc2" runat="server">
| |
| |
| | </cc1:TabContaine r>
| |
| | </div>
| |
| |
| |
| | </form>
| |
| | </body>
| |
| | </html>
| |
| |
| |
| | aspx.cs
| |
| | using System;
| |
| | using System.Configur ation;
| |
| | using System.Data;
| |
| | using System.Linq;
| |
| | using System.Web;
| |
| | using System.Web.Secu rity;
| |
| | using System.Web.UI;
| |
| | using System.Web.UI.H tmlControls;
| |
| | using System.Web.UI.W ebControls;
| |
| | using System.Web.UI.W ebControls.WebP arts;
| |
| | using System.Xml.Linq ;
| |
| | using AjaxControlTool kit;
| |
| | public partial class _Default : System.Web.UI.P age
| |
| | {
| |
| | protected void Page_Init(objec t sender, EventArgs e)
| |
| | {
| |
| | this.tc1.Tabs[0].Controls.Add(n ew LiteralControl( "I can add content to
| an
| | existing panel"));
| |
| | TabPanel panel = new TabPanel();
| |
| | panel.HeaderTex t = "tab2";
| |
| | panel.Controls. Add(new LiteralControl( "I can even add a new panel to a
| | container which already has a panel"));
| |
| | this.tc1.Tabs.A dd(panel);
| |
| | TabPanel[] newpanels = new TabPanel[3];
| |
| | for (int iCnt = 0; iCnt < 3; iCnt++)
| |
| | {
| |
| | newpanels[iCnt] = new TabPanel();
| |
| | newpanels[iCnt].HeaderText = String.Concat(" New Panel" + iCnt);
| |
| | newpanels[iCnt].Controls.Add(n ew LiteralControl( "But I can't add new
| | panels"));
| |
| | this.tc2.Tabs.A dd(newpanels[iCnt]);
| |
| | }
| |
| |
| | }
| |
| |
| |
| |
| | }
| |
| |
| |
| |
| |
| | The source of the resultant page is below(note that the dynamically
| added
| | tags are styled as "display:no ne; visibility:hidd en"):
| | <div class="ajax__ta b_xp" id="tc1" style="visibili ty:hidden;">
| | <div id="tc1_header" >
| | <span id="__tab_tc1_T abPanel1">TabPa nel1</span><span
| | id="__tab_tc1_c tl00">tab2</span>
| | </div><div id="tc1_body">
| | <div id="tc1_TabPane l1">
| | This is the content - I can add content to an existing panel
| | </div><div id="tc1_ctl00" style="display: none;visibility :hidden;">
| | I can even add a new panel to a container which already has a panel
| | </div>
| | </div>
| | </div>
| | </div>
| |
| |
| | <div>
| | <div class="ajax__ta b_xp" id="tc2" style="visibili ty:hidden;">
| | <div id="tc2_header" >
| | <span id="__tab_tc2_c tl00">New Panel0</span><span
| id="__tab_tc2_c tl01">New
| | Panel1</span><span id="__tab_tc2_c tl02">New Panel2</span>
| | </div><div id="tc2_body">
| | <div id="tc2_ctl00" style="display: none;visibility :hidden;">
| | But I can't add new panels
| | </div><div id="tc2_ctl01" style="display: none;visibility :hidden;">
| | But I can't add new panels
| | </div><div id="tc2_ctl02" style="display: none;visibility :hidden;">
| | But I can't add new panels
| | </div>
| | </div>
| | </div>
| | </div>
| |
| |
| |
| |
| |
| |
| >
|
|
|
|

Oct 10 '08 #4
Hi Richard,

Can my suggestions help?

Regards,
Allen Chen
Microsoft Online Support
--------------------
| From: "RichB" <ri**********@c ommunity.nospam >
| References: <ub************ **@TK2MSFTNGP06 .phx.gbl>
<Uo************ **@TK2MSFTNGHUB 02.phx.gbl>
| Subject: Re: Asp.Net AJAX dynamically added Tab Control not displaying
| Date: Thu, 9 Oct 2008 14:33:45 +0100
| Lines: 371
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
| X-RFC2646: Format=Flowed; Original
| Message-ID: <uu************ **@TK2MSFTNGP02 .phx.gbl>
| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| NNTP-Posting-Host: 93-96-97-68.zone4.bether e.co.uk 93.96.97.68
| Path: TK2MSFTNGHUB02. phx.gbl!TK2MSFT NGP01.phx.gbl!T K2MSFTNGP02.phx .gbl
| Xref: TK2MSFTNGHUB02. phx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:7759 1
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
|
| Allen thanks again,
|
| I am slowly getting to grips with the lifecycle, but would never have
picked
| this up. I do actually have the source for the ajaxtoolkit, but if I had
| just downloaded the dlls then is trying each of the delegate methods for
the
| lifecycle the only way that I could have established this? or is the mere
| presence of the OnInit override an indication that content should be
added
| PreInit.
|
| I assume however that it is also true, some actions cannot be taken until
| after a lifecycle event has occured, though I would appreciate it if you
| could point me at some decumentation with examples which illustrates this
| point.
|
| My final aim is to add the control within the Accordion custom control
that
| you helped me with previously. I have tried to do this today, by
including a
| tab panel within the ContentUserCont rol. Although I have the Accordion
| control constructed at Page_PreInit within the aspx file, the Tabbed
Panels
| within the TabContainer within the CustomUserCOntr ol are not being added.
|
| What is happening in this case? My code extracts are below.
|
| If you can recomend some documents/books which I can read around the
subject
| of page life cycle I would appreciate it. Although I think I understand
the
| stages of the lifecyle, I don't seem to have a full understanding of the
| lifecyle where custom/user controls are involved.
|
| Thanks,
| Richard
|
| ContentUserCont rol.ascx.cs
| <%@ Control Language="C#" AutoEventWireup ="true"
|
| CodeFile="Conte ntUserControl.a scx.cs"
| Inherits="Accor dionTest.Conten tUserControl" %>
|
| <%@ Register Assembly="AjaxC ontrolToolkit" Namespace="Ajax ControlToolkit"
|
| TagPrefix="cc1" %>
|
|
|
| <cc1:TabContain er runat="server" ID = "tc1"><cc1:TabP anel
| HeaderText="0"> <ContentTemplat e>fist tab</ContentTemplate ></cc1:TabPanel>
|
| <cc1:TabPanel HeaderText="1"> <ContentTemplat e>is the second
| tab</ContentTemplate </cc1:TabPanel></cc1:TabContaine r>
|
| <asp:Button ID="Button1" runat="server" Text="Button"
onload="Button1 _Load"
|
| />
|
|
| Browser Source:
| <div id="Accordion1" >
| <input type="hidden" name="Accordion 1_AccordionExte nder_ClientStat e"
| id="Accordion1_ AccordionExtend er_ClientState" /><div>
| <div style="backgrou nd-color:Gray;">
| <span id="ctl07_ctl01 _Label1">Header Test_96</span>
| </div>
| </div><div style="display: block;">
| <div class="ajax__ta b_xp" id="ctl08_ctl00 _tc1"
style="visibili ty:hidden;">
| <div id="ctl08_ctl00 _tc1_header">
|
| </div><div id="ctl08_ctl00 _tc1_body">
|
| </div>
| </div>
|
| <input type="submit" name="ctl08$ctl 00$Button1" value="ContentT est_96"
| id="ctl08_ctl00 _Button1" />
|
| </div>
|
| "Allen Chen [MSFT]" <v-******@online.m icrosoft.comwro te in message
| news:Uo******** ******@TK2MSFTN GHUB02.phx.gbl. ..
| Hi Richard,
| >
| Please try to use Page_PreInit instead of Page_Init.
| >
| The OnInit of TabContainer fires earlier than the Page_Init. Thus, if we
| add controls in the Page_Init the TabPanels will not be shown.
| >
| Please have a look at the source code of the TabContainer control:
| protected override void OnInit(EventArg s e)
| {
| base.OnInit(e);
| this.Page.Regis terRequiresCont rolState(this);
| this._initializ ed = true;
| if (this._cachedAc tiveTabIndex -1)
| {
| this.ActiveTabI ndex = this._cachedAct iveTabIndex;
| }
| else if (this.Tabs.Coun t 0)
| {
| this.ActiveTabI ndex = 0;
| }
| }
| >
| We can see if there's no tabs added in the TabContainer the
ActiveTabIndex
| will not be assigned 0. And The default value of the ActiveTabIndex is
-1.
| On the render stage, TabContainer will check the ActiveTabIndex. If
| it's -1
| then definitely no tab will be shown.
| >
| Please have a try and let me know if it works.
| Regards,
| Allen Chen
| Microsoft Online Community Support
| >
| >
| Delighting our customers is our #1 priority. We welcome your comments
and
| suggestions about how we can improve the support we provide to you.
Please
| feel free to let my manager know what you think of the level of service
| provided. You can send feedback directly to my manager at:
| ms****@microsof t.com.
| >
| =============== =============== =============== =====
| Get notification to my posts through email? Please refer to
| >
http://msdn.microsoft.com/en-us/subs...#notifications.
| >
| Note: The MSDN Managed Newsgroup support offering is for non-urgent
issues
| where an initial response from the community or a Microsoft Support
| Engineer within 1 business day is acceptable. Please note that each
follow
| up response may take approximately 2 business days as the support
| professional working with you may need further investigation to reach
the
| most efficient resolution. The offering is not appropriate for
situations
| that require urgent, real-time or phone-based interactions or complex
| project analysis and dump analysis issues. Issues of this nature are
best
| handled working with a dedicated Microsoft Support Engineer by
contacting
| Microsoft Customer Support Services (CSS) at
| >
http://support.microsoft.com/select/...tance&ln=en-us.
| =============== =============== =============== =====
| This posting is provided "AS IS" with no warranties, and confers no
| rights.
| >
| --------------------
| | From: "RichB" <ri**********@c ommunity.nospam >
| | Subject: Asp.Net AJAX dynamically added Tab Control not displaying
| | Date: Tue, 7 Oct 2008 17:01:41 +0100
| | Lines: 204
| | X-Priority: 3
| | X-MSMail-Priority: Normal
| | X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
| | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
| | X-RFC2646: Format=Flowed; Original
| | Message-ID: <ub************ **@TK2MSFTNGP06 .phx.gbl>
| | Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| | NNTP-Posting-Host: 93-96-97-68.zone4.bether e.co.uk 93.96.97.68
| | Path: TK2MSFTNGHUB02. phx.gbl!TK2MSFT NGP01.phx.gbl!T K2MSFTNGP06.phx .gbl
| | Xref: TK2MSFTNGHUB02. phx.gbl
| microsoft.publi c.dotnet.framew ork.aspnet:7745 7
| | X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
| |
| | I am trying to get to grips with the asp.net ajaxcontrol toolkit, and
am
| | trying to add a tabbed control to the page.
| |
| | I have no problems within the aspx file, and can dynamically
manipulate
| a
| | tabcontainer which has 1 panel already, however I want to try create
the
| | TabPanels dynamically. I followed the advice here:
| |
| | http://www.asp.net/learn/ajax-videos/video-156.aspx (3rd comment - Joe
| | Stagner)
| |
| | I am finding that the container is hidden.
| |
| | I have found that I can work around this by creating the first tab
| within
| | the aspx, then performing RemoveAt(0) to remove that tab when I've
added
| the
| | others. This works, but is not ideal as I can't add the original
| container
| | dynamically. Is there another way to do this, and what is the reason
for
| | this behaviour?
| |
| |
| | Thanks,
| | Richard
| |
| |
| | My code is as follows:
| | aspx
| | <%@ Page Language="C#" AutoEventWireup ="true"
CodeFile="Defau lt.aspx.cs"
| |
| | Inherits="_Defa ult" %>
| |
| | <%@ Register Assembly="AjaxC ontrolToolkit"
| Namespace="Ajax ControlToolkit"
| |
| | TagPrefix="cc1" %>
| |
| |
| |
| | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
| |
| | "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
| |
| | <html xmlns="http://www.w3.org/1999/xhtml">
| |
| | <head id="Head1" runat="server">
| |
| | <title>Untitl ed Page</title>
| |
| | </head>
| |
| | <body>
| |
| | <form id="form1" runat="server">
| |
| | <div>
| |
| | <asp:ScriptMana ger ID="ScriptManag er1" runat="server">
| |
| | </asp:ScriptManag er>
| |
| |
| |
| |
| | <cc1:TabContain er ID="tc1" runat="server" >
| |
| | <cc1:TabPanel runat="server" HeaderText="Tab Panel1" ID="TabPanel1" >
| |
| | <ContentTemplat e>This is the content - </ContentTemplate >
| |
| | </cc1:TabPanel></cc1:TabContaine r>
| |
| | </div>
| |
| |
| |
| | <div>
| |
| | <cc1:TabContain er ID="tc2" runat="server">
| |
| |
| | </cc1:TabContaine r>
| |
| | </div>
| |
| |
| |
| | </form>
| |
| | </body>
| |
| | </html>
| |
| |
| |
| | aspx.cs
| |
| | using System;
| |
| | using System.Configur ation;
| |
| | using System.Data;
| |
| | using System.Linq;
| |
| | using System.Web;
| |
| | using System.Web.Secu rity;
| |
| | using System.Web.UI;
| |
| | using System.Web.UI.H tmlControls;
| |
| | using System.Web.UI.W ebControls;
| |
| | using System.Web.UI.W ebControls.WebP arts;
| |
| | using System.Xml.Linq ;
| |
| | using AjaxControlTool kit;
| |
| | public partial class _Default : System.Web.UI.P age
| |
| | {
| |
| | protected void Page_Init(objec t sender, EventArgs e)
| |
| | {
| |
| | this.tc1.Tabs[0].Controls.Add(n ew LiteralControl( "I can add content to
| an
| | existing panel"));
| |
| | TabPanel panel = new TabPanel();
| |
| | panel.HeaderTex t = "tab2";
| |
| | panel.Controls. Add(new LiteralControl( "I can even add a new panel to a
| | container which already has a panel"));
| |
| | this.tc1.Tabs.A dd(panel);
| |
| | TabPanel[] newpanels = new TabPanel[3];
| |
| | for (int iCnt = 0; iCnt < 3; iCnt++)
| |
| | {
| |
| | newpanels[iCnt] = new TabPanel();
| |
| | newpanels[iCnt].HeaderText = String.Concat(" New Panel" + iCnt);
| |
| | newpanels[iCnt].Controls.Add(n ew LiteralControl( "But I can't add new
| | panels"));
| |
| | this.tc2.Tabs.A dd(newpanels[iCnt]);
| |
| | }
| |
| |
| | }
| |
| |
| |
| |
| | }
| |
| |
| |
| |
| |
| | The source of the resultant page is below(note that the dynamically
| added
| | tags are styled as "display:no ne; visibility:hidd en"):
| | <div class="ajax__ta b_xp" id="tc1" style="visibili ty:hidden;">
| | <div id="tc1_header" >
| | <span id="__tab_tc1_T abPanel1">TabPa nel1</span><span
| | id="__tab_tc1_c tl00">tab2</span>
| | </div><div id="tc1_body">
| | <div id="tc1_TabPane l1">
| | This is the content - I can add content to an existing panel
| | </div><div id="tc1_ctl00" style="display: none;visibility :hidden;">
| | I can even add a new panel to a container which already has a panel
| | </div>
| | </div>
| | </div>
| | </div>
| |
| |
| | <div>
| | <div class="ajax__ta b_xp" id="tc2" style="visibili ty:hidden;">
| | <div id="tc2_header" >
| | <span id="__tab_tc2_c tl00">New Panel0</span><span
| id="__tab_tc2_c tl01">New
| | Panel1</span><span id="__tab_tc2_c tl02">New Panel2</span>
| | </div><div id="tc2_body">
| | <div id="tc2_ctl00" style="display: none;visibility :hidden;">
| | But I can't add new panels
| | </div><div id="tc2_ctl01" style="display: none;visibility :hidden;">
| | But I can't add new panels
| | </div><div id="tc2_ctl02" style="display: none;visibility :hidden;">
| | But I can't add new panels
| | </div>
| | </div>
| | </div>
| | </div>
| |
| |
| |
| |
| |
| |
| >
|
|
|
|

Oct 15 '08 #5
Allen,

It hasn't solved the problem, as I had already moved the code to
Page_PreInit, but hadn't had time to think it through fully and recheck my
work . If I need to I'll then put together an example with a couple of
scenarios which are and are not working as I would expect.

I'll probably manage to do this tomorrow and email them to you as you
suggested, or update this post if I find that it works.

Either way, I think that the tips for looking at the lifecycle will be
useful, and I have found some useful references to basic lifecyle in various
books.

Thanks, Richard
"Allen Chen [MSFT]" <v-******@online.m icrosoft.comwro te in message
news:X3******** ********@TK2MSF TNGHUB02.phx.gb l...
Hi Richard,

Can my suggestions help?

Regards,
Allen Chen
Microsoft Online Support
--------------------
| From: "RichB" <ri**********@c ommunity.nospam >
| References: <ub************ **@TK2MSFTNGP06 .phx.gbl>
<Uo************ **@TK2MSFTNGHUB 02.phx.gbl>
| Subject: Re: Asp.Net AJAX dynamically added Tab Control not displaying
| Date: Thu, 9 Oct 2008 14:33:45 +0100
| Lines: 371
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
| X-RFC2646: Format=Flowed; Original
| Message-ID: <uu************ **@TK2MSFTNGP02 .phx.gbl>
| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| NNTP-Posting-Host: 93-96-97-68.zone4.bether e.co.uk 93.96.97.68
| Path: TK2MSFTNGHUB02. phx.gbl!TK2MSFT NGP01.phx.gbl!T K2MSFTNGP02.phx .gbl
| Xref: TK2MSFTNGHUB02. phx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:7759 1
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
|
| Allen thanks again,
|
| I am slowly getting to grips with the lifecycle, but would never have
picked
| this up. I do actually have the source for the ajaxtoolkit, but if I had
| just downloaded the dlls then is trying each of the delegate methods for
the
| lifecycle the only way that I could have established this? or is the
mere
| presence of the OnInit override an indication that content should be
added
| PreInit.
|
| I assume however that it is also true, some actions cannot be taken
until
| after a lifecycle event has occured, though I would appreciate it if you
| could point me at some decumentation with examples which illustrates
this
| point.
|
| My final aim is to add the control within the Accordion custom control
that
| you helped me with previously. I have tried to do this today, by
including a
| tab panel within the ContentUserCont rol. Although I have the Accordion
| control constructed at Page_PreInit within the aspx file, the Tabbed
Panels
| within the TabContainer within the CustomUserCOntr ol are not being
added.
|
| What is happening in this case? My code extracts are below.
|
| If you can recomend some documents/books which I can read around the
subject
| of page life cycle I would appreciate it. Although I think I understand
the
| stages of the lifecyle, I don't seem to have a full understanding of the
| lifecyle where custom/user controls are involved.
|
| Thanks,
| Richard
|
| ContentUserCont rol.ascx.cs
| <%@ Control Language="C#" AutoEventWireup ="true"
|
| CodeFile="Conte ntUserControl.a scx.cs"
| Inherits="Accor dionTest.Conten tUserControl" %>
|
| <%@ Register Assembly="AjaxC ontrolToolkit"
Namespace="Ajax ControlToolkit"
|
| TagPrefix="cc1" %>
|
|
|
| <cc1:TabContain er runat="server" ID = "tc1"><cc1:TabP anel
| HeaderText="0"> <ContentTemplat e>fist
tab</ContentTemplate ></cc1:TabPanel>
|
| <cc1:TabPanel HeaderText="1"> <ContentTemplat e>is the second
| tab</ContentTemplate </cc1:TabPanel></cc1:TabContaine r>
|
| <asp:Button ID="Button1" runat="server" Text="Button"
onload="Button1 _Load"
|
| />
|
|
| Browser Source:
| <div id="Accordion1" >
| <input type="hidden" name="Accordion 1_AccordionExte nder_ClientStat e"
| id="Accordion1_ AccordionExtend er_ClientState" /><div>
| <div style="backgrou nd-color:Gray;">
| <span id="ctl07_ctl01 _Label1">Header Test_96</span>
| </div>
| </div><div style="display: block;">
| <div class="ajax__ta b_xp" id="ctl08_ctl00 _tc1"
style="visibili ty:hidden;">
| <div id="ctl08_ctl00 _tc1_header">
|
| </div><div id="ctl08_ctl00 _tc1_body">
|
| </div>
| </div>
|
| <input type="submit" name="ctl08$ctl 00$Button1" value="ContentT est_96"
| id="ctl08_ctl00 _Button1" />
|
| </div>
|
| "Allen Chen [MSFT]" <v-******@online.m icrosoft.comwro te in message
| news:Uo******** ******@TK2MSFTN GHUB02.phx.gbl. ..
| Hi Richard,
| >
| Please try to use Page_PreInit instead of Page_Init.
| >
| The OnInit of TabContainer fires earlier than the Page_Init. Thus, if
we
| add controls in the Page_Init the TabPanels will not be shown.
| >
| Please have a look at the source code of the TabContainer control:
| protected override void OnInit(EventArg s e)
| {
| base.OnInit(e);
| this.Page.Regis terRequiresCont rolState(this);
| this._initializ ed = true;
| if (this._cachedAc tiveTabIndex -1)
| {
| this.ActiveTabI ndex = this._cachedAct iveTabIndex;
| }
| else if (this.Tabs.Coun t 0)
| {
| this.ActiveTabI ndex = 0;
| }
| }
| >
| We can see if there's no tabs added in the TabContainer the
ActiveTabIndex
| will not be assigned 0. And The default value of the ActiveTabIndex is
-1.
| On the render stage, TabContainer will check the ActiveTabIndex. If
| it's -1
| then definitely no tab will be shown.
| >
| Please have a try and let me know if it works.
| Regards,
| Allen Chen
| Microsoft Online Community Support
| >
| >
| Delighting our customers is our #1 priority. We welcome your comments
and
| suggestions about how we can improve the support we provide to you.
Please
| feel free to let my manager know what you think of the level of
service
| provided. You can send feedback directly to my manager at:
| ms****@microsof t.com.
| >
| =============== =============== =============== =====
| Get notification to my posts through email? Please refer to
| >
http://msdn.microsoft.com/en-us/subs...#notifications.
| >
| Note: The MSDN Managed Newsgroup support offering is for non-urgent
issues
| where an initial response from the community or a Microsoft Support
| Engineer within 1 business day is acceptable. Please note that each
follow
| up response may take approximately 2 business days as the support
| professional working with you may need further investigation to reach
the
| most efficient resolution. The offering is not appropriate for
situations
| that require urgent, real-time or phone-based interactions or complex
| project analysis and dump analysis issues. Issues of this nature are
best
| handled working with a dedicated Microsoft Support Engineer by
contacting
| Microsoft Customer Support Services (CSS) at
| >
http://support.microsoft.com/select/...tance&ln=en-us.
| =============== =============== =============== =====
| This posting is provided "AS IS" with no warranties, and confers no
| rights.
| >
| --------------------
| | From: "RichB" <ri**********@c ommunity.nospam >
| | Subject: Asp.Net AJAX dynamically added Tab Control not displaying
| | Date: Tue, 7 Oct 2008 17:01:41 +0100
| | Lines: 204
| | X-Priority: 3
| | X-MSMail-Priority: Normal
| | X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
| | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
| | X-RFC2646: Format=Flowed; Original
| | Message-ID: <ub************ **@TK2MSFTNGP06 .phx.gbl>
| | Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| | NNTP-Posting-Host: 93-96-97-68.zone4.bether e.co.uk 93.96.97.68
| | Path:
TK2MSFTNGHUB02. phx.gbl!TK2MSFT NGP01.phx.gbl!T K2MSFTNGP06.phx .gbl
| | Xref: TK2MSFTNGHUB02. phx.gbl
| microsoft.publi c.dotnet.framew ork.aspnet:7745 7
| | X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
| |
| | I am trying to get to grips with the asp.net ajaxcontrol toolkit,
and
am
| | trying to add a tabbed control to the page.
| |
| | I have no problems within the aspx file, and can dynamically
manipulate
| a
| | tabcontainer which has 1 panel already, however I want to try create
the
| | TabPanels dynamically. I followed the advice here:
| |
| | http://www.asp.net/learn/ajax-videos/video-156.aspx (3rd comment -
Joe
| | Stagner)
| |
| | I am finding that the container is hidden.
| |
| | I have found that I can work around this by creating the first tab
| within
| | the aspx, then performing RemoveAt(0) to remove that tab when I've
added
| the
| | others. This works, but is not ideal as I can't add the original
| container
| | dynamically. Is there another way to do this, and what is the reason
for
| | this behaviour?
| |
| |
| | Thanks,
| | Richard
| |
| |
| | My code is as follows:
| | aspx
| | <%@ Page Language="C#" AutoEventWireup ="true"
CodeFile="Defau lt.aspx.cs"
| |
| | Inherits="_Defa ult" %>
| |
| | <%@ Register Assembly="AjaxC ontrolToolkit"
| Namespace="Ajax ControlToolkit"
| |
| | TagPrefix="cc1" %>
| |
| |
| |
| | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
| |
| | "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
| |
| | <html xmlns="http://www.w3.org/1999/xhtml">
| |
| | <head id="Head1" runat="server">
| |
| | <title>Untitl ed Page</title>
| |
| | </head>
| |
| | <body>
| |
| | <form id="form1" runat="server">
| |
| | <div>
| |
| | <asp:ScriptMana ger ID="ScriptManag er1" runat="server">
| |
| | </asp:ScriptManag er>
| |
| |
| |
| |
| | <cc1:TabContain er ID="tc1" runat="server" >
| |
| | <cc1:TabPanel runat="server" HeaderText="Tab Panel1" ID="TabPanel1" >
| |
| | <ContentTemplat e>This is the content - </ContentTemplate >
| |
| | </cc1:TabPanel></cc1:TabContaine r>
| |
| | </div>
| |
| |
| |
| | <div>
| |
| | <cc1:TabContain er ID="tc2" runat="server">
| |
| |
| | </cc1:TabContaine r>
| |
| | </div>
| |
| |
| |
| | </form>
| |
| | </body>
| |
| | </html>
| |
| |
| |
| | aspx.cs
| |
| | using System;
| |
| | using System.Configur ation;
| |
| | using System.Data;
| |
| | using System.Linq;
| |
| | using System.Web;
| |
| | using System.Web.Secu rity;
| |
| | using System.Web.UI;
| |
| | using System.Web.UI.H tmlControls;
| |
| | using System.Web.UI.W ebControls;
| |
| | using System.Web.UI.W ebControls.WebP arts;
| |
| | using System.Xml.Linq ;
| |
| | using AjaxControlTool kit;
| |
| | public partial class _Default : System.Web.UI.P age
| |
| | {
| |
| | protected void Page_Init(objec t sender, EventArgs e)
| |
| | {
| |
| | this.tc1.Tabs[0].Controls.Add(n ew LiteralControl( "I can add content
to
| an
| | existing panel"));
| |
| | TabPanel panel = new TabPanel();
| |
| | panel.HeaderTex t = "tab2";
| |
| | panel.Controls. Add(new LiteralControl( "I can even add a new panel to
a
| | container which already has a panel"));
| |
| | this.tc1.Tabs.A dd(panel);
| |
| | TabPanel[] newpanels = new TabPanel[3];
| |
| | for (int iCnt = 0; iCnt < 3; iCnt++)
| |
| | {
| |
| | newpanels[iCnt] = new TabPanel();
| |
| | newpanels[iCnt].HeaderText = String.Concat(" New Panel" + iCnt);
| |
| | newpanels[iCnt].Controls.Add(n ew LiteralControl( "But I can't add new
| | panels"));
| |
| | this.tc2.Tabs.A dd(newpanels[iCnt]);
| |
| | }
| |
| |
| | }
| |
| |
| |
| |
| | }
| |
| |
| |
| |
| |
| | The source of the resultant page is below(note that the dynamically
| added
| | tags are styled as "display:no ne; visibility:hidd en"):
| | <div class="ajax__ta b_xp" id="tc1" style="visibili ty:hidden;">
| | <div id="tc1_header" >
| | <span id="__tab_tc1_T abPanel1">TabPa nel1</span><span
| | id="__tab_tc1_c tl00">tab2</span>
| | </div><div id="tc1_body">
| | <div id="tc1_TabPane l1">
| | This is the content - I can add content to an existing panel
| | </div><div id="tc1_ctl00" style="display: none;visibility :hidden;">
| | I can even add a new panel to a container which already has a panel
| | </div>
| | </div>
| | </div>
| | </div>
| |
| |
| | <div>
| | <div class="ajax__ta b_xp" id="tc2" style="visibili ty:hidden;">
| | <div id="tc2_header" >
| | <span id="__tab_tc2_c tl00">New Panel0</span><span
| id="__tab_tc2_c tl01">New
| | Panel1</span><span id="__tab_tc2_c tl02">New Panel2</span>
| | </div><div id="tc2_body">
| | <div id="tc2_ctl00" style="display: none;visibility :hidden;">
| | But I can't add new panels
| | </div><div id="tc2_ctl01" style="display: none;visibility :hidden;">
| | But I can't add new panels
| | </div><div id="tc2_ctl02" style="display: none;visibility :hidden;">
| | But I can't add new panels
| | </div>
| | </div>
| | </div>
| | </div>
| |
| |
| |
| |
| |
| |
| >
|
|
|
|

Oct 15 '08 #6
Allen,

Thanks for your help. I have worked through a few different configurations
this morning in an example app and all have worked fine whilst building the
Page at
PreInit.

When I've tried to incorporate in my actual App I am still having some
issues, though now that I know that I can create the correct form, I'm sure
that I can find where the problem lies and solve it.

Many thanks for your help.

Richard

"Allen Chen [MSFT]" <v-******@online.m icrosoft.comwro te in message
news:X3******** ********@TK2MSF TNGHUB02.phx.gb l...
Hi Richard,

Can my suggestions help?

Regards,
Allen Chen
Microsoft Online Support
--------------------
| From: "RichB" <ri**********@c ommunity.nospam >
| References: <ub************ **@TK2MSFTNGP06 .phx.gbl>
<Uo************ **@TK2MSFTNGHUB 02.phx.gbl>
| Subject: Re: Asp.Net AJAX dynamically added Tab Control not displaying
| Date: Thu, 9 Oct 2008 14:33:45 +0100
| Lines: 371
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
| X-RFC2646: Format=Flowed; Original
| Message-ID: <uu************ **@TK2MSFTNGP02 .phx.gbl>
| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| NNTP-Posting-Host: 93-96-97-68.zone4.bether e.co.uk 93.96.97.68
| Path: TK2MSFTNGHUB02. phx.gbl!TK2MSFT NGP01.phx.gbl!T K2MSFTNGP02.phx .gbl
| Xref: TK2MSFTNGHUB02. phx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:7759 1
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
|
| Allen thanks again,
|
| I am slowly getting to grips with the lifecycle, but would never have
picked
| this up. I do actually have the source for the ajaxtoolkit, but if I had
| just downloaded the dlls then is trying each of the delegate methods for
the
| lifecycle the only way that I could have established this? or is the
mere
| presence of the OnInit override an indication that content should be
added
| PreInit.
|
| I assume however that it is also true, some actions cannot be taken
until
| after a lifecycle event has occured, though I would appreciate it if you
| could point me at some decumentation with examples which illustrates
this
| point.
|
| My final aim is to add the control within the Accordion custom control
that
| you helped me with previously. I have tried to do this today, by
including a
| tab panel within the ContentUserCont rol. Although I have the Accordion
| control constructed at Page_PreInit within the aspx file, the Tabbed
Panels
| within the TabContainer within the CustomUserCOntr ol are not being
added.
|
| What is happening in this case? My code extracts are below.
|
| If you can recomend some documents/books which I can read around the
subject
| of page life cycle I would appreciate it. Although I think I understand
the
| stages of the lifecyle, I don't seem to have a full understanding of the
| lifecyle where custom/user controls are involved.
|
| Thanks,
| Richard
|
| ContentUserCont rol.ascx.cs
| <%@ Control Language="C#" AutoEventWireup ="true"
|
| CodeFile="Conte ntUserControl.a scx.cs"
| Inherits="Accor dionTest.Conten tUserControl" %>
|
| <%@ Register Assembly="AjaxC ontrolToolkit"
Namespace="Ajax ControlToolkit"
|
| TagPrefix="cc1" %>
|
|
|
| <cc1:TabContain er runat="server" ID = "tc1"><cc1:TabP anel
| HeaderText="0"> <ContentTemplat e>fist
tab</ContentTemplate ></cc1:TabPanel>
|
| <cc1:TabPanel HeaderText="1"> <ContentTemplat e>is the second
| tab</ContentTemplate </cc1:TabPanel></cc1:TabContaine r>
|
| <asp:Button ID="Button1" runat="server" Text="Button"
onload="Button1 _Load"
|
| />
|
|
| Browser Source:
| <div id="Accordion1" >
| <input type="hidden" name="Accordion 1_AccordionExte nder_ClientStat e"
| id="Accordion1_ AccordionExtend er_ClientState" /><div>
| <div style="backgrou nd-color:Gray;">
| <span id="ctl07_ctl01 _Label1">Header Test_96</span>
| </div>
| </div><div style="display: block;">
| <div class="ajax__ta b_xp" id="ctl08_ctl00 _tc1"
style="visibili ty:hidden;">
| <div id="ctl08_ctl00 _tc1_header">
|
| </div><div id="ctl08_ctl00 _tc1_body">
|
| </div>
| </div>
|
| <input type="submit" name="ctl08$ctl 00$Button1" value="ContentT est_96"
| id="ctl08_ctl00 _Button1" />
|
| </div>
|
| "Allen Chen [MSFT]" <v-******@online.m icrosoft.comwro te in message
| news:Uo******** ******@TK2MSFTN GHUB02.phx.gbl. ..
| Hi Richard,
| >
| Please try to use Page_PreInit instead of Page_Init.
| >
| The OnInit of TabContainer fires earlier than the Page_Init. Thus, if
we
| add controls in the Page_Init the TabPanels will not be shown.
| >
| Please have a look at the source code of the TabContainer control:
| protected override void OnInit(EventArg s e)
| {
| base.OnInit(e);
| this.Page.Regis terRequiresCont rolState(this);
| this._initializ ed = true;
| if (this._cachedAc tiveTabIndex -1)
| {
| this.ActiveTabI ndex = this._cachedAct iveTabIndex;
| }
| else if (this.Tabs.Coun t 0)
| {
| this.ActiveTabI ndex = 0;
| }
| }
| >
| We can see if there's no tabs added in the TabContainer the
ActiveTabIndex
| will not be assigned 0. And The default value of the ActiveTabIndex is
-1.
| On the render stage, TabContainer will check the ActiveTabIndex. If
| it's -1
| then definitely no tab will be shown.
| >
| Please have a try and let me know if it works.
| Regards,
| Allen Chen
| Microsoft Online Community Support
| >
| >
| Delighting our customers is our #1 priority. We welcome your comments
and
| suggestions about how we can improve the support we provide to you.
Please
| feel free to let my manager know what you think of the level of
service
| provided. You can send feedback directly to my manager at:
| ms****@microsof t.com.
| >
| =============== =============== =============== =====
| Get notification to my posts through email? Please refer to
| >
http://msdn.microsoft.com/en-us/subs...#notifications.
| >
| Note: The MSDN Managed Newsgroup support offering is for non-urgent
issues
| where an initial response from the community or a Microsoft Support
| Engineer within 1 business day is acceptable. Please note that each
follow
| up response may take approximately 2 business days as the support
| professional working with you may need further investigation to reach
the
| most efficient resolution. The offering is not appropriate for
situations
| that require urgent, real-time or phone-based interactions or complex
| project analysis and dump analysis issues. Issues of this nature are
best
| handled working with a dedicated Microsoft Support Engineer by
contacting
| Microsoft Customer Support Services (CSS) at
| >
http://support.microsoft.com/select/...tance&ln=en-us.
| =============== =============== =============== =====
| This posting is provided "AS IS" with no warranties, and confers no
| rights.
| >
| --------------------
| | From: "RichB" <ri**********@c ommunity.nospam >
| | Subject: Asp.Net AJAX dynamically added Tab Control not displaying
| | Date: Tue, 7 Oct 2008 17:01:41 +0100
| | Lines: 204
| | X-Priority: 3
| | X-MSMail-Priority: Normal
| | X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
| | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
| | X-RFC2646: Format=Flowed; Original
| | Message-ID: <ub************ **@TK2MSFTNGP06 .phx.gbl>
| | Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| | NNTP-Posting-Host: 93-96-97-68.zone4.bether e.co.uk 93.96.97.68
| | Path:
TK2MSFTNGHUB02. phx.gbl!TK2MSFT NGP01.phx.gbl!T K2MSFTNGP06.phx .gbl
| | Xref: TK2MSFTNGHUB02. phx.gbl
| microsoft.publi c.dotnet.framew ork.aspnet:7745 7
| | X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
| |
| | I am trying to get to grips with the asp.net ajaxcontrol toolkit,
and
am
| | trying to add a tabbed control to the page.
| |
| | I have no problems within the aspx file, and can dynamically
manipulate
| a
| | tabcontainer which has 1 panel already, however I want to try create
the
| | TabPanels dynamically. I followed the advice here:
| |
| | http://www.asp.net/learn/ajax-videos/video-156.aspx (3rd comment -
Joe
| | Stagner)
| |
| | I am finding that the container is hidden.
| |
| | I have found that I can work around this by creating the first tab
| within
| | the aspx, then performing RemoveAt(0) to remove that tab when I've
added
| the
| | others. This works, but is not ideal as I can't add the original
| container
| | dynamically. Is there another way to do this, and what is the reason
for
| | this behaviour?
| |
| |
| | Thanks,
| | Richard
| |
| |
| | My code is as follows:
| | aspx
| | <%@ Page Language="C#" AutoEventWireup ="true"
CodeFile="Defau lt.aspx.cs"
| |
| | Inherits="_Defa ult" %>
| |
| | <%@ Register Assembly="AjaxC ontrolToolkit"
| Namespace="Ajax ControlToolkit"
| |
| | TagPrefix="cc1" %>
| |
| |
| |
| | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
| |
| | "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
| |
| | <html xmlns="http://www.w3.org/1999/xhtml">
| |
| | <head id="Head1" runat="server">
| |
| | <title>Untitl ed Page</title>
| |
| | </head>
| |
| | <body>
| |
| | <form id="form1" runat="server">
| |
| | <div>
| |
| | <asp:ScriptMana ger ID="ScriptManag er1" runat="server">
| |
| | </asp:ScriptManag er>
| |
| |
| |
| |
| | <cc1:TabContain er ID="tc1" runat="server" >
| |
| | <cc1:TabPanel runat="server" HeaderText="Tab Panel1" ID="TabPanel1" >
| |
| | <ContentTemplat e>This is the content - </ContentTemplate >
| |
| | </cc1:TabPanel></cc1:TabContaine r>
| |
| | </div>
| |
| |
| |
| | <div>
| |
| | <cc1:TabContain er ID="tc2" runat="server">
| |
| |
| | </cc1:TabContaine r>
| |
| | </div>
| |
| |
| |
| | </form>
| |
| | </body>
| |
| | </html>
| |
| |
| |
| | aspx.cs
| |
| | using System;
| |
| | using System.Configur ation;
| |
| | using System.Data;
| |
| | using System.Linq;
| |
| | using System.Web;
| |
| | using System.Web.Secu rity;
| |
| | using System.Web.UI;
| |
| | using System.Web.UI.H tmlControls;
| |
| | using System.Web.UI.W ebControls;
| |
| | using System.Web.UI.W ebControls.WebP arts;
| |
| | using System.Xml.Linq ;
| |
| | using AjaxControlTool kit;
| |
| | public partial class _Default : System.Web.UI.P age
| |
| | {
| |
| | protected void Page_Init(objec t sender, EventArgs e)
| |
| | {
| |
| | this.tc1.Tabs[0].Controls.Add(n ew LiteralControl( "I can add content
to
| an
| | existing panel"));
| |
| | TabPanel panel = new TabPanel();
| |
| | panel.HeaderTex t = "tab2";
| |
| | panel.Controls. Add(new LiteralControl( "I can even add a new panel to
a
| | container which already has a panel"));
| |
| | this.tc1.Tabs.A dd(panel);
| |
| | TabPanel[] newpanels = new TabPanel[3];
| |
| | for (int iCnt = 0; iCnt < 3; iCnt++)
| |
| | {
| |
| | newpanels[iCnt] = new TabPanel();
| |
| | newpanels[iCnt].HeaderText = String.Concat(" New Panel" + iCnt);
| |
| | newpanels[iCnt].Controls.Add(n ew LiteralControl( "But I can't add new
| | panels"));
| |
| | this.tc2.Tabs.A dd(newpanels[iCnt]);
| |
| | }
| |
| |
| | }
| |
| |
| |
| |
| | }
| |
| |
| |
| |
| |
| | The source of the resultant page is below(note that the dynamically
| added
| | tags are styled as "display:no ne; visibility:hidd en"):
| | <div class="ajax__ta b_xp" id="tc1" style="visibili ty:hidden;">
| | <div id="tc1_header" >
| | <span id="__tab_tc1_T abPanel1">TabPa nel1</span><span
| | id="__tab_tc1_c tl00">tab2</span>
| | </div><div id="tc1_body">
| | <div id="tc1_TabPane l1">
| | This is the content - I can add content to an existing panel
| | </div><div id="tc1_ctl00" style="display: none;visibility :hidden;">
| | I can even add a new panel to a container which already has a panel
| | </div>
| | </div>
| | </div>
| | </div>
| |
| |
| | <div>
| | <div class="ajax__ta b_xp" id="tc2" style="visibili ty:hidden;">
| | <div id="tc2_header" >
| | <span id="__tab_tc2_c tl00">New Panel0</span><span
| id="__tab_tc2_c tl01">New
| | Panel1</span><span id="__tab_tc2_c tl02">New Panel2</span>
| | </div><div id="tc2_body">
| | <div id="tc2_ctl00" style="display: none;visibility :hidden;">
| | But I can't add new panels
| | </div><div id="tc2_ctl01" style="display: none;visibility :hidden;">
| | But I can't add new panels
| | </div><div id="tc2_ctl02" style="display: none;visibility :hidden;">
| | But I can't add new panels
| | </div>
| | </div>
| | </div>
| | </div>
| |
| |
| |
| |
| |
| |
| >
|
|
|
|


Oct 16 '08 #7
Hi Richard,

Good job! If you need further assistance please don't hesitate to let me
know.

Regards,
Allen Chen
Microsoft Online Support
--------------------
| From: "RichB" <ri**********@c ommunity.nospam >
| References: <ub************ **@TK2MSFTNGP06 .phx.gbl>
<Uo************ **@TK2MSFTNGHUB 02.phx.gbl>
<uu************ **@TK2MSFTNGP02 .phx.gbl>
<X3************ **@TK2MSFTNGHUB 02.phx.gbl>
| Subject: Re: Asp.Net AJAX dynamically added Tab Control not displaying
| Date: Thu, 16 Oct 2008 15:52:27 +0100
| Lines: 463
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
| X-RFC2646: Format=Flowed; Original
| Message-ID: <ee************ **@TK2MSFTNGP06 .phx.gbl>
| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| NNTP-Posting-Host: 93-96-97-68.zone4.bether e.co.uk 93.96.97.68
| Path: TK2MSFTNGHUB02. phx.gbl!TK2MSFT NGP01.phx.gbl!T K2MSFTNGP06.phx .gbl
| Xref: TK2MSFTNGHUB02. phx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:7799 8
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
|
| Allen,
|
| Thanks for your help. I have worked through a few different configurations
| this morning in an example app and all have worked fine whilst building
the
| Page at
| PreInit.
|
| When I've tried to incorporate in my actual App I am still having some
| issues, though now that I know that I can create the correct form, I'm
sure
| that I can find where the problem lies and solve it.
|
| Many thanks for your help.
|
| Richard
|
|
|
| "Allen Chen [MSFT]" <v-******@online.m icrosoft.comwro te in message
| news:X3******** ********@TK2MSF TNGHUB02.phx.gb l...
| Hi Richard,
| >
| Can my suggestions help?
| >
| Regards,
| Allen Chen
| Microsoft Online Support
| --------------------
| | From: "RichB" <ri**********@c ommunity.nospam >
| | References: <ub************ **@TK2MSFTNGP06 .phx.gbl>
| <Uo************ **@TK2MSFTNGHUB 02.phx.gbl>
| | Subject: Re: Asp.Net AJAX dynamically added Tab Control not displaying
| | Date: Thu, 9 Oct 2008 14:33:45 +0100
| | Lines: 371
| | X-Priority: 3
| | X-MSMail-Priority: Normal
| | X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
| | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
| | X-RFC2646: Format=Flowed; Original
| | Message-ID: <uu************ **@TK2MSFTNGP02 .phx.gbl>
| | Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| | NNTP-Posting-Host: 93-96-97-68.zone4.bether e.co.uk 93.96.97.68
| | Path: TK2MSFTNGHUB02. phx.gbl!TK2MSFT NGP01.phx.gbl!T K2MSFTNGP02.phx .gbl
| | Xref: TK2MSFTNGHUB02. phx.gbl
| microsoft.publi c.dotnet.framew ork.aspnet:7759 1
| | X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
| |
| | Allen thanks again,
| |
| | I am slowly getting to grips with the lifecycle, but would never have
| picked
| | this up. I do actually have the source for the ajaxtoolkit, but if I
had
| | just downloaded the dlls then is trying each of the delegate methods
for
| the
| | lifecycle the only way that I could have established this? or is the
| mere
| | presence of the OnInit override an indication that content should be
| added
| | PreInit.
| |
| | I assume however that it is also true, some actions cannot be taken
| until
| | after a lifecycle event has occured, though I would appreciate it if
you
| | could point me at some decumentation with examples which illustrates
| this
| | point.
| |
| | My final aim is to add the control within the Accordion custom control
| that
| | you helped me with previously. I have tried to do this today, by
| including a
| | tab panel within the ContentUserCont rol. Although I have the Accordion
| | control constructed at Page_PreInit within the aspx file, the Tabbed
| Panels
| | within the TabContainer within the CustomUserCOntr ol are not being
| added.
| |
| | What is happening in this case? My code extracts are below.
| |
| | If you can recomend some documents/books which I can read around the
| subject
| | of page life cycle I would appreciate it. Although I think I
understand
| the
| | stages of the lifecyle, I don't seem to have a full understanding of
the
| | lifecyle where custom/user controls are involved.
| |
| | Thanks,
| | Richard
| |
| | ContentUserCont rol.ascx.cs
| | <%@ Control Language="C#" AutoEventWireup ="true"
| |
| | CodeFile="Conte ntUserControl.a scx.cs"
| | Inherits="Accor dionTest.Conten tUserControl" %>
| |
| | <%@ Register Assembly="AjaxC ontrolToolkit"
| Namespace="Ajax ControlToolkit"
| |
| | TagPrefix="cc1" %>
| |
| |
| |
| | <cc1:TabContain er runat="server" ID = "tc1"><cc1:TabP anel
| | HeaderText="0"> <ContentTemplat e>fist
| tab</ContentTemplate ></cc1:TabPanel>
| |
| | <cc1:TabPanel HeaderText="1"> <ContentTemplat e>is the second
| | tab</ContentTemplate </cc1:TabPanel></cc1:TabContaine r>
| |
| | <asp:Button ID="Button1" runat="server" Text="Button"
| onload="Button1 _Load"
| |
| | />
| |
| |
| | Browser Source:
| | <div id="Accordion1" >
| | <input type="hidden" name="Accordion 1_AccordionExte nder_ClientStat e"
| | id="Accordion1_ AccordionExtend er_ClientState" /><div>
| | <div style="backgrou nd-color:Gray;">
| | <span id="ctl07_ctl01 _Label1">Header Test_96</span>
| | </div>
| | </div><div style="display: block;">
| | <div class="ajax__ta b_xp" id="ctl08_ctl00 _tc1"
| style="visibili ty:hidden;">
| | <div id="ctl08_ctl00 _tc1_header">
| |
| | </div><div id="ctl08_ctl00 _tc1_body">
| |
| | </div>
| | </div>
| |
| | <input type="submit" name="ctl08$ctl 00$Button1" value="ContentT est_96"
| | id="ctl08_ctl00 _Button1" />
| |
| | </div>
| |
| | "Allen Chen [MSFT]" <v-******@online.m icrosoft.comwro te in message
| | news:Uo******** ******@TK2MSFTN GHUB02.phx.gbl. ..
| | Hi Richard,
| | >
| | Please try to use Page_PreInit instead of Page_Init.
| | >
| | The OnInit of TabContainer fires earlier than the Page_Init. Thus,
if
| we
| | add controls in the Page_Init the TabPanels will not be shown.
| | >
| | Please have a look at the source code of the TabContainer control:
| | protected override void OnInit(EventArg s e)
| | {
| | base.OnInit(e);
| | this.Page.Regis terRequiresCont rolState(this);
| | this._initializ ed = true;
| | if (this._cachedAc tiveTabIndex -1)
| | {
| | this.ActiveTabI ndex = this._cachedAct iveTabIndex;
| | }
| | else if (this.Tabs.Coun t 0)
| | {
| | this.ActiveTabI ndex = 0;
| | }
| | }
| | >
| | We can see if there's no tabs added in the TabContainer the
| ActiveTabIndex
| | will not be assigned 0. And The default value of the ActiveTabIndex
is
| -1.
| | On the render stage, TabContainer will check the ActiveTabIndex. If
| | it's -1
| | then definitely no tab will be shown.
| | >
| | Please have a try and let me know if it works.
| | Regards,
| | Allen Chen
| | Microsoft Online Community Support
| | >
| | >
| | Delighting our customers is our #1 priority. We welcome your
comments
| and
| | suggestions about how we can improve the support we provide to you.
| Please
| | feel free to let my manager know what you think of the level of
| service
| | provided. You can send feedback directly to my manager at:
| | ms****@microsof t.com.
| | >
| | =============== =============== =============== =====
| | Get notification to my posts through email? Please refer to
| | >
| >
http://msdn.microsoft.com/en-us/subs...#notifications.
| | >
| | Note: The MSDN Managed Newsgroup support offering is for non-urgent
| issues
| | where an initial response from the community or a Microsoft Support
| | Engineer within 1 business day is acceptable. Please note that each
| follow
| | up response may take approximately 2 business days as the support
| | professional working with you may need further investigation to
reach
| the
| | most efficient resolution. The offering is not appropriate for
| situations
| | that require urgent, real-time or phone-based interactions or
complex
| | project analysis and dump analysis issues. Issues of this nature are
| best
| | handled working with a dedicated Microsoft Support Engineer by
| contacting
| | Microsoft Customer Support Services (CSS) at
| | >
| >
http://support.microsoft.com/select/...tance&ln=en-us.
| | =============== =============== =============== =====
| | This posting is provided "AS IS" with no warranties, and confers no
| | rights.
| | >
| | --------------------
| | | From: "RichB" <ri**********@c ommunity.nospam >
| | | Subject: Asp.Net AJAX dynamically added Tab Control not displaying
| | | Date: Tue, 7 Oct 2008 17:01:41 +0100
| | | Lines: 204
| | | X-Priority: 3
| | | X-MSMail-Priority: Normal
| | | X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
| | | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
| | | X-RFC2646: Format=Flowed; Original
| | | Message-ID: <ub************ **@TK2MSFTNGP06 .phx.gbl>
| | | Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| | | NNTP-Posting-Host: 93-96-97-68.zone4.bether e.co.uk 93.96.97.68
| | | Path:
| TK2MSFTNGHUB02. phx.gbl!TK2MSFT NGP01.phx.gbl!T K2MSFTNGP06.phx .gbl
| | | Xref: TK2MSFTNGHUB02. phx.gbl
| | microsoft.publi c.dotnet.framew ork.aspnet:7745 7
| | | X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
| | |
| | | I am trying to get to grips with the asp.net ajaxcontrol toolkit,
| and
| am
| | | trying to add a tabbed control to the page.
| | |
| | | I have no problems within the aspx file, and can dynamically
| manipulate
| | a
| | | tabcontainer which has 1 panel already, however I want to try
create
| the
| | | TabPanels dynamically. I followed the advice here:
| | |
| | | http://www.asp.net/learn/ajax-videos/video-156.aspx (3rd comment -
| Joe
| | | Stagner)
| | |
| | | I am finding that the container is hidden.
| | |
| | | I have found that I can work around this by creating the first tab
| | within
| | | the aspx, then performing RemoveAt(0) to remove that tab when I've
| added
| | the
| | | others. This works, but is not ideal as I can't add the original
| | container
| | | dynamically. Is there another way to do this, and what is the
reason
| for
| | | this behaviour?
| | |
| | |
| | | Thanks,
| | | Richard
| | |
| | |
| | | My code is as follows:
| | | aspx
| | | <%@ Page Language="C#" AutoEventWireup ="true"
| CodeFile="Defau lt.aspx.cs"
| | |
| | | Inherits="_Defa ult" %>
| | |
| | | <%@ Register Assembly="AjaxC ontrolToolkit"
| | Namespace="Ajax ControlToolkit"
| | |
| | | TagPrefix="cc1" %>
| | |
| | |
| | |
| | | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
| | |
| | | "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
| | |
| | | <html xmlns="http://www.w3.org/1999/xhtml">
| | |
| | | <head id="Head1" runat="server">
| | |
| | | <title>Untitl ed Page</title>
| | |
| | | </head>
| | |
| | | <body>
| | |
| | | <form id="form1" runat="server">
| | |
| | | <div>
| | |
| | | <asp:ScriptMana ger ID="ScriptManag er1" runat="server">
| | |
| | | </asp:ScriptManag er>
| | |
| | |
| | |
| | |
| | | <cc1:TabContain er ID="tc1" runat="server" >
| | |
| | | <cc1:TabPanel runat="server" HeaderText="Tab Panel1"
ID="TabPanel1" >
| | |
| | | <ContentTemplat e>This is the content - </ContentTemplate >
| | |
| | | </cc1:TabPanel></cc1:TabContaine r>
| | |
| | | </div>
| | |
| | |
| | |
| | | <div>
| | |
| | | <cc1:TabContain er ID="tc2" runat="server">
| | |
| | |
| | | </cc1:TabContaine r>
| | |
| | | </div>
| | |
| | |
| | |
| | | </form>
| | |
| | | </body>
| | |
| | | </html>
| | |
| | |
| | |
| | | aspx.cs
| | |
| | | using System;
| | |
| | | using System.Configur ation;
| | |
| | | using System.Data;
| | |
| | | using System.Linq;
| | |
| | | using System.Web;
| | |
| | | using System.Web.Secu rity;
| | |
| | | using System.Web.UI;
| | |
| | | using System.Web.UI.H tmlControls;
| | |
| | | using System.Web.UI.W ebControls;
| | |
| | | using System.Web.UI.W ebControls.WebP arts;
| | |
| | | using System.Xml.Linq ;
| | |
| | | using AjaxControlTool kit;
| | |
| | | public partial class _Default : System.Web.UI.P age
| | |
| | | {
| | |
| | | protected void Page_Init(objec t sender, EventArgs e)
| | |
| | | {
| | |
| | | this.tc1.Tabs[0].Controls.Add(n ew LiteralControl( "I can add
content
| to
| | an
| | | existing panel"));
| | |
| | | TabPanel panel = new TabPanel();
| | |
| | | panel.HeaderTex t = "tab2";
| | |
| | | panel.Controls. Add(new LiteralControl( "I can even add a new panel
to
| a
| | | container which already has a panel"));
| | |
| | | this.tc1.Tabs.A dd(panel);
| | |
| | | TabPanel[] newpanels = new TabPanel[3];
| | |
| | | for (int iCnt = 0; iCnt < 3; iCnt++)
| | |
| | | {
| | |
| | | newpanels[iCnt] = new TabPanel();
| | |
| | | newpanels[iCnt].HeaderText = String.Concat(" New Panel" + iCnt);
| | |
| | | newpanels[iCnt].Controls.Add(n ew LiteralControl( "But I can't add
new
| | | panels"));
| | |
| | | this.tc2.Tabs.A dd(newpanels[iCnt]);
| | |
| | | }
| | |
| | |
| | | }
| | |
| | |
| | |
| | |
| | | }
| | |
| | |
| | |
| | |
| | |
| | | The source of the resultant page is below(note that the
dynamically
| | added
| | | tags are styled as "display:no ne; visibility:hidd en"):
| | | <div class="ajax__ta b_xp" id="tc1" style="visibili ty:hidden;">
| | | <div id="tc1_header" >
| | | <span id="__tab_tc1_T abPanel1">TabPa nel1</span><span
| | | id="__tab_tc1_c tl00">tab2</span>
| | | </div><div id="tc1_body">
| | | <div id="tc1_TabPane l1">
| | | This is the content - I can add content to an existing panel
| | | </div><div id="tc1_ctl00" style="display: none;visibility :hidden;">
| | | I can even add a new panel to a container which already has a
panel
| | | </div>
| | | </div>
| | | </div>
| | | </div>
| | |
| | |
| | | <div>
| | | <div class="ajax__ta b_xp" id="tc2" style="visibili ty:hidden;">
| | | <div id="tc2_header" >
| | | <span id="__tab_tc2_c tl00">New Panel0</span><span
| | id="__tab_tc2_c tl01">New
| | | Panel1</span><span id="__tab_tc2_c tl02">New Panel2</span>
| | | </div><div id="tc2_body">
| | | <div id="tc2_ctl00" style="display: none;visibility :hidden;">
| | | But I can't add new panels
| | | </div><div id="tc2_ctl01" style="display: none;visibility :hidden;">
| | | But I can't add new panels
| | | </div><div id="tc2_ctl02" style="display: none;visibility :hidden;">
| | | But I can't add new panels
| | | </div>
| | | </div>
| | | </div>
| | | </div>
| | |
| | |
| | |
| | |
| | |
| | |
| | >
| |
| |
| |
| |
| >
|
|
|
|

Oct 17 '08 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
4312
by: Donald Xie | last post by:
Hi, I noticed an interesting effect when working with controls that are dynamically loaded. For instance, on a web form with a PlaceHolder control named ImageHolder, I dynamically add an image button at runtime: //----- Code snippet protected System.Web.UI.WebControls.PlaceHolder ImageHolder; private void Page_Load(object sender, System.EventArgs e)
12
3486
by: nat | last post by:
Hi all, I was going to post this in the AJAX forum, but apparently someone posted an AJAX/C# question in there today and was told to try this forum instead. So here goes: I'm trying to figure out whether AJAX will work with dynamically created controls in C#.NET. I have been able to get non-dynamically created controls to work, but so far none of my dynamic controls or events linked to them are able to work with AJAX. Does anyone know...
1
2468
by: AndiSmith | last post by:
Hi guys, I wondered if anyone could help me with this problem, or even shed some light on the direction I need to take to resolve it? I'm using .NET 2.0 (C# flavor) to build a large user-based website. I've created an AJAX based user control, which is dynamically placed on a page (once, or multiple times) if the user has the correct permissions to receive it. It contains two drop down lists - employee value and partner value; and a...
1
9686
by: William Youngman | last post by:
I have a gridview displaying data and would like to use the AJAX dropdown extender so that when the user clicks on a record a dropdown menu will display providing the user with a menu of selections to choose from (yes much like the SharePoint 2007 dropdown menu). I'm having problems dynamically binding the 'TargetControlID' property of the extender control to the record label in the gridview. What I'm doing is - The label's text is the...
8
3109
by: Samik R. | last post by:
Hello, I am using the innerHTML property of a div placeholder to update the contents, and the HTML is provided from a perl script on the server side. The perl script gets called through AJAX when I press a button in the first page. The returned HTML in the div has another button, which, when pressed, should call the same perl script again. Think of the program as some sort of wizard. The problem is, this works perfectly as expected in FF...
2
1139
navneetkaur
by: navneetkaur | last post by:
hello every1 i am developing web application.its at the edge of completion...bt i want to add ajax to it...i have added at some places bt problem is with 1 page in this am displaying some records in a table 'd am doing this dynamically depending on records row of tables are increased...we can add new records 'd as well as delete old records...bt i need at the same time this shd be reflected in table so when i add/update i jst use...
1
1427
by: jrcapp | last post by:
Let's see if I can clearly explain what I am doing with AJAX. On my Web site, I have a TabContainer that has 2 TabPanels. Inside each Panel, I am dynamically (using a SQL query) creating an Accordion AJAX control that displays the content in each tab. On the Header of each Accordion, I am including a DropDownExtender control onto it. So, when someone hovers over the text "" a drop down will appear that they click on and their options...
1
3399
by: =?Utf-8?B?TW9oc2luIEtoYW4=?= | last post by:
Hi, I am working on a website where i am creating Horizontal Menus Dynamically from database as per rights available to the user. I have several UserControls. And the Menu control also brings UserControl's URL stored in Database while Page load. There is a TabContainer control below the Menu Control. Now i want to add corresponding UserControl dynamically when user clicks on
0
2915
by: sanrek | last post by:
Hi Folks, Slider control is driving me nuts, below is the code from my test page's page load event, nothing great about code, I have a place holder control into which I am adding a table which has three rows with a slider control in each row created dynamically. The problems what I have are 1) handler image does not get displayed, I have set the handleImageUrl and have moved the handlecssclass and railcssclass into local style sheet 2)...
0
8672
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9257
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9017
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7876
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6594
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4689
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3125
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2462
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2070
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.