Question

My webapp (written in ASP.NET) is laid out with MasterPages. In the content area of the Masterpage, the is an iframe that I display the pages. On navigation click I simple set the ContentUrl (within the contentplaceholder) to a new url and it refreshes the content area.

Here is the method that does that:

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

But was I also need is to set the ContentUrl within javascript at certain times and show the page. However when I set the ContentUrl the page does not show. how do I refresh the contentplaceholder in javascript?

Here is the code that I have for javascript so far:

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;
    }
}
Was it helpful?

Solution

$find was being called before the page loaded fully, therefore no controls were present

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top