我的webapp (用ASP.NET编写)是用MasterPages编写的。在母版页的内容区域中,是我显示页面的iframe。在导航时,单击I simple将ContentUrl (在content占位符中)设置为新的url,它将刷新内容区域。
下面是实现这一点的方法:
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中刷新内容占位符?
这是到目前为止我为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;
}
}发布于 2012-07-17 15:34:39
在页面完全加载之前调用了$find,因此不存在任何控件
https://stackoverflow.com/questions/11460379
复制相似问题