简体   繁体   English

如何在不回发的情况下将.aspx页面动态加载到contentplaceholder中?

[英]How to load a .aspx page into contentplaceholder dynamically without postback?

I wanted to load a .aspx page into contentplaceholder without making a postback. 我想在不进行回发的情况下将.aspx页面加载到contentplaceholder中。 What I have is a master page with 3 contentplaceholders 我所拥有的是一个包含3个contentplaceholders的母版页

1.headerContent 2.leftContent 3.mainContent 1.headerContent 2.leftContent 3.mainContent

I have 3 links in the headercontent and according to the selection of those 3 links, i'm showing few menu's on the leftcontent. 我在headercontent中有3个链接,根据对这3个链接的选择,我在leftcontent上显示了几个菜单。 On selecting any of the loaded menu on the left content i wanted to show/load a .aspx page inside the "maincontent" through the codebehind(C#), without making a refresh or postback. 选择左侧内容上的任何已加载菜单后,我想通过codebehind(C#)在“ maincontent”中显示/加载一个.aspx页面,而不进行刷新或回发。 The .aspx pages which i wanted to load aren't inheriting the masterpage. 我要加载的.aspx页面没有继承母版页。

Other than using Iframes, is there any way to accomplish this?? 除了使用iframe,还有什么方法可以做到这一点?

What I can suggest is to use user controls (.ascx) instead of pages. 我可以建议使用用户控件(.ascx)而不是页面。 Have one page that loads all the controls from the start, this page will use the master page and will have its content place holder as the mainContent. 有一个页面从一开始就加载了所有控件,该页面将使用母版页并将其内容占位符作为mainContent。

You can have each control inside a div on the page, and set the display of the div to none. 您可以在页面上的div中包含每个控件,并将div的显示设置为none。 Then you can use java script to display just the relevant user control. 然后,您可以使用Java脚本仅显示相关的用户控件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM