View Full Version : OnDocumentReady with Treeview HTC (in a popup)

09-19-2006, 03:37 PM
I've seeing a very odd behavior:
I've got a treeview control (implemented with treeview.htc) that
renders fine.
If I put that treeview on a page, it renders and behaves normally.
If I put that treeview into a popup (created with
window.createPopup()), it renders fine, but the onDocumentReady event
never fires. onContentReady does, but onDocumentReady does not?
What's that leave me? A treeview that renders with no events

Very very odd.

<HTML><!-- XMLNS:mytree>-->
<!-- <?IMPORT NAMESPACE="mytree" IMPLEMENTATION="treeview.htc"/> -->
function makePopup(x,y){
var oCWBSPopup
if(!window.oCWBSPopup) {
oCWBSPopup = window.createPopup();
oCWBSPopup.document.body.style.border="2px white window-inset";

// as you can see, we're making a poup with an embedded treeview
// using write, we can set the namespace and perform an import
// directive - remember that these elements are not in the DOM
// and are not scriptable. The tree RENDERS fine, but never
// attaches events, and the onDocumentReady event never fires.

var popupBody[0] = '<HTML XMLNS:mytree><HEAD>';
popupBody[1] = '<?IMPORT NAMESPACE="mytree" ';
popupBody[2] = ' IMPLEMENTATION="treeview.htc"/>';
popupBody[3] = '</HEAD><BODY>';
popupBody[4] = '<mytree:treeview id="tree1" ';
popupBody[5] = ' TreeNodeSrc="template.xml" ';
popupBody[6] = ' TreeNodeXsltSrc="template.xsl" />';
popupBody[7] = '</BODY></HTML>';
window.oCWBSPopup = oCWBSPopup;
} else
oCWBSPopup = window.oCWBSPopup;
<form id="Form1" method="post" runat="server">
<span onclick="makePopup(event.x,event.y);" >
<img src="images/folder.gif"/>

<!-- When the HTML comment blocks are
un-commented, the regular treeview below
works fine -->
<mytree:treeview id="tree1"
TreeNodeXsltSrc="template.xsl" /> -->