开发者

What is the best way to include content within an AJAX TabContainer?

开发者 https://www.devze.com 2023-01-15 03:22 出处:网络
I didn\'t want to have a ton of code on one page, but to keep the code modular and simple.So in my TabContainer I have the following where each tab refers to a web page and my code is inside each web

I didn't want to have a ton of code on one page, but to keep the code modular and simple. So in my TabContainer I have the following where each tab refers to a web page and my code is inside each web page. My TabContainer itself is inside the default.aspx page.

    <asp:TabContainer ID="tabTOL" runat="server" ActiveTabIndex="0" CssClass="tol">
        <asp:TabPanel ID="tabHome" runat="server" TabIndex="0" HeaderText="Home">
            <ContentTemplate>
                <iframe src="Home.aspx"></iframe>
            </ContentTemplate>
        </asp:TabPanel>
        ..开发者_开发问答.

Of course, the problem is that I cannot refer to other tabs or the TabContainer/default page from within any tab. I'm trying to update a TextBox on the default.aspx page from a tab, but there is no reference to it.

Should I bite the bullet and have one huge web page with all the html and code behind? There are a dozen tabs in my TabContainer. I would think this would slow down processing as well. Or, is there a cleaner way to do this and still retain the ability to reference controls on the main page or other tabs?

I'm working in VS2008 and .Net 3.5 and AJAX 3.5.

Thanks!! Larry


I would suggest that you change the structure of Home.Aspx into a Web User Control (*.ascx). The advantage is that you are now running within the context of the parent page. Therefore all it's functionality is within reach. For example, to acces a textbox on the parent page, from the Home.Ascx, you would do this:

  ((Default)this.Parent).txtMyTextBox.Text = "Hello";
0

精彩评论

暂无评论...
验证码 换一张
取 消