You are not logged in.

Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Friday, April 26th 2019, 1:55pm

Pano Viewer Disappears

Hi,
I'm having a problem where when I try to load a specific scene in response to the selection of a treeview node, the entire viewer just disappears. Any ideas as to why this is happening?

Default.aspx

<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">

<div class="container-fluid">

<script src="Krpano/vtour/tour.js"></script>


<div class="row">
<div class="col-sm-3">
<h3>Hello from col 1</h3>
<asp:TreeView ID="TreeView1" runat="server" OnSelectedNodeChanged="TreeView1_SelectedNodeChanged">
<Nodes>
<asp:TreeNode Text="Option Set 1" SelectAction="None">
<asp:TreeNode Text="Option A" Value="1A"></asp:TreeNode>
<asp:TreeNode Text="Option B" Value="1B"></asp:TreeNode>
</asp:TreeNode>
</Nodes>
</asp:TreeView>
<asp:TreeView ID="TreeView2" runat="server" OnSelectedNodeChanged="TreeView2_SelectedNodeChanged">
<Nodes>
<asp:TreeNode Text="Option Set 2" SelectAction="None">
<asp:TreeNode Text="Option A" Value="2A"></asp:TreeNode>
<asp:TreeNode Text="Option B" Value="2B"></asp:TreeNode>
</asp:TreeNode>
</Nodes>
</asp:TreeView>
<asp:TreeView ID="TreeView3" runat="server" OnSelectedNodeChanged="TreeView3_SelectedNodeChanged">
<Nodes>
<asp:TreeNode Text="Option Set 3" SelectAction="None">
<asp:TreeNode Text="Option A" Value="3A"></asp:TreeNode>
<asp:TreeNode Text="Option B" Value="3B"></asp:TreeNode>
</asp:TreeNode>
</Nodes>
</asp:TreeView>
</div>

<div class="col-sm-9" id="pano1" style="height:800px">
<h3>Hello from col 2</h3>
<script>
function initialPano()
{
embedpano({ swf: null, xml: "Krpano/vtour/tour.xml", target: "pano1", localfallback: "http://localhost:8090", html5: "auto" });
var krpano1 = document.getElementById("krpanoSWFObject");
krpano1.call("loadpanoscene('tour.xml', 'scene_PanoImg10a', null, null, NOBLEND);");
}

</script>
<script>
function updatePano(sceneID)
{
var krpano1 = document.getElementById("krpanoSWFObject");
krpano1.call("loadpanoscene('tour.xml', " +sceneID+ ", null, null, NOBLEND);");
}
</script>
<script>
function createSceneID()
{
var tv1 = document.getElementById("TreeView1");
var tv2 = document.getElementById("TreeView2");
var tv3 = document.getElementById("TreeView3");
var sceneID = tv1_Data.selectedNodeID.value + tv2_Data.selectedNodeID.value + tv3_Data.selectedNodeID.value;

if (sceneID = "1A2A3A") {
sceneID = "scene_PanoImg10a"
}
else if (sceneID = "1B2A3A") { sceneID = "scene_PanoImg02a" }
else if (sceneID = "1A2B3A") { sceneID = "scene_PanoImg09a" }
else if (sceneID = "1A2A3B") { sceneID = "scene_PanoImg01a" }
else if (sceneID = "1B2B3A") { sceneID = "scene_PanoImg08a" }
else if (sceneID = "1B2A3B") { sceneID = "scene_PanoImg04a" }
else if (sceneID = "1A2B3B") { sceneID = "scene_PanoImg03a" }
else if (sceneID = "1B2B3B") { sceneID = "scene_PanoImg06a" }
return sceneID;
}
</script>
</div>
</div>
</div>


</asp:Content>


Default.aspx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class _Default : Page
{
protected void Page_Load(object sender, EventArgs e)
{

ScriptManager.RegisterStartupScript(this, GetType(), "initialPano", "initialPano()", true);

var nodeValue1 = "1A";

foreach (TreeNode node in TreeView1.Nodes)
{
if (node.Value == nodeValue1)
{
node.Selected = true;
}
}

var nodeValue2 = "2A";

foreach (TreeNode node in TreeView2.Nodes)
{
if (node.Value == nodeValue2)
{
node.Selected = true;
}
}

var nodeValue3 = "3A";

foreach (TreeNode node in TreeView3.Nodes)
{
if (node.Value == nodeValue3)
{
node.Selected = true;
}
}
}

protected void TreeView1_SelectedNodeChanged(object sender, EventArgs e)
{
ScriptManager.RegisterStartupScript(this, GetType(), "updatePano", "createSceneID()", true);
ScriptManager.RegisterStartupScript(this, GetType(), "updatePano", "updatePano(createSceneID())", true);

}

protected void TreeView2_SelectedNodeChanged(object sender, EventArgs e)
{
ScriptManager.RegisterStartupScript(this, GetType(), "updatePano", "updatePano(createSceneID())", true);
ScriptManager.RegisterStartupScript(this, GetType(), "updatePano", "createSceneID()", true);
}

protected void TreeView3_SelectedNodeChanged(object sender, EventArgs e)
{
ScriptManager.RegisterStartupScript(this, GetType(), "updatePano", "updatePano(createSceneID())", true);
ScriptManager.RegisterStartupScript(this, GetType(), "updatePano", "createSceneID()", true);
}
}