0
我的webapp(用ASP.NET编写)是用MasterPages布局的。在主页面的内容区域中,我是显示页面的iframe。在导航上单击我简单设置ContentUrl(在contentplaceholder内)到一个新的url,并刷新内容区域。刷新ContentPlaceHolder使用javascript
下面是确实的方法:
Protected Sub radprojecttree_NodeClick(sender As Object, e As Telerik.Web.UI.RadTreeNodeEventArgs) Handles radprojecttree.NodeClick
Dim ts As String = e.Node.Attributes("contentpage")
radpancontentholder.ContentUrl = ts
If (Not SiteUser Is Nothing) Then
BSRMaster.navtree.NavTree_InitNodes(Nothing, e.Node)
End If
End Sub
但我还需要在某些时候在JavaScript中设置的contentURL和显示页面。但是,当我设置ContentUrl页面不显示。如何刷新JavaScript中的contentplaceholder?
下面是我对JavaScript至今代码:页面完全加载之前被称为
function goToPage(){
var strLoc = "";
switch (AutoExpandOption) {
case "RestoreLastNode" :
strLoc = readCookie(strUser + 'LastPageLocation');
if ((typeof(strLoc) == "undefined") || (strLoc == null)) {
strLoc = 'Secure/TaskManager.aspx';
createCookie(strUser + 'LastPageLocation', 'TaskManager.aspx', 100);
}
break;
case "GoToTaskManager" :
strLoc = 'Secure/TaskManager.aspx';
break;
case "GoToDashboard" :
strLoc = 'Secure/Dashboards.aspx';
break;
}
if (strLoc != "") {
var ph = $find('ctl00_radpancontentholder');
ph._contentUrl = strLoc;
//document.getElementById('pagecontentframe').src = strLoc;
}
}
你的注释行应该工作,我相信。您是否肯定该函数正在被调用并且源代码是否正确?我会建议尝试在控制台中执行实时测试。最初的src是否有效?也许你需要一些额外的信息到src(比如http:// localhost /)。在更新之前,请执行console.log(document.getElementById(“pagecontentframe”)。src); – EricG 2012-07-12 22:57:34