在 AJAX TabContainer 中包含内容的最佳方式是什么?
我不想在一页上有大量代码,而是为了保持代码模块化和简单。因此,在我的 TabContainer 中,我有以下内容,其中每个选项卡都引用一个网页,而我的代码位于每个网页内。我的 TabContainer 本身位于 default.aspx 页面内。
<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>
...
当然,问题是我无法从任何选项卡中引用其他选项卡或 TabContainer/默认页面。我正在尝试从选项卡更新 default.aspx 页面上的文本框,但没有引用它。
我应该硬着头皮拥有一个包含所有 html 和代码的巨大网页吗?我的 TabContainer 中有十几个选项卡。我认为这也会减慢处理速度。或者,是否有一种更简洁的方法来执行此操作,并且仍然保留引用主页或其他选项卡上的控件的能力?
我正在 VS2008、.Net 3.5 和 AJAX 3.5 中工作。
谢谢!! 拉里
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我建议您将 Home.Aspx 的结构更改为 Web 用户控件 (*.ascx)。优点是您现在正在父页面的上下文中运行。因此,它的所有功能都触手可及。例如,要从 Home.Ascx 访问父页面上的文本框,您可以执行以下操作:
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: