I am trying to programmatically add an UltraWebTree to my web page. The aspx page is like this...
<%@ Page language="c#" Codebehind="editUser.aspx.cs" AutoEventWireup="false" Inherits="DatStat.CustomConsole.Admin.editUser" %><%@ Register Assembly="Infragistics2.WebUI.UltraWebNavigator.v8.2, Version=8.2.20082.1000, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" Namespace="Infragistics.WebUI.UltraWebNavigator" TagPrefix="ignav" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>...</head>
<body>
<form id="frmEditUser" method="post" runat="server" onsubmit="return validateForm(this);"> <div id="divControls"> <fieldset> <table cellspacing="0" class="controlsTable" summary="Form for editing user properties"> <tbody> <tr> <td colspan="3"> <ignav:UltraWebTree ID="uwtSiteTree" runat="server" DefaultImage="../Img/ig_treeFolderClosed.gif" DefaultSelectedImage="../Img/ig_treeFolderOpen.gif" ExpandImage="../Img/ig_treePlus.gif" CollapseImage="../Img/ig_treeMinus.gif" CheckBoxes="true"> </ignav:UltraWebTree> </td> </tr> ...
The c# code is like this...
uwtSiteTree = new UltraWebTree(); uwtSiteTree.CheckBoxes = true; foreach( SiteInfo site in siteList ) { if( site.GetParentId() == -1 ) uwtSiteTree.Nodes.Add( site.GetName(), site.GetSiteId() ); else { Node parentNode = _webTree.Find( site.GetParentId() ); parentNode.Nodes.Add( site.GetName(), site.GetSiteId() ); } }
The code seems to put what it is supposed to in the web tree but nothing appears on the page. View source give me this...
<tr> <td colspan="3">
<input type="hidden" id="uwtSiteTree" name="uwtSiteTree" value="">
<span style="display:none;"></span>
<style type="text/css"> <!-- --> </style>
<div title='' id='T_uwtSiteTree' tabIndex=0 clr2='true' onmouseover="BLOCKED SCRIPTigtree_mouseover(event,'uwtSiteTree');" onmouseout="BLOCKED SCRIPTigtree_mouseout(event,'uwtSiteTree');" onkeydown="BLOCKED SCRIPTigtree_keydown(event,'uwtSiteTree');" onkeyup="BLOCKED SCRIPTigtree_keyup(event,'uwtSiteTree');" onclick="BLOCKED SCRIPTigtree_nodeclick(event,'uwtSiteTree');" ondblclick="BLOCKED SCRIPTigtree_dblclick(event,'uwtSiteTree');" oncontextmenu="BLOCKED SCRIPTigtree_contextmenu(event,'uwtSiteTree');" onselectstart="BLOCKED SCRIPTigtree_selectStart();" onscroll="BLOCKED SCRIPTigtree_onscroll('uwtSiteTree');" style="overflow:auto; cursor:Default;"><nobr><div align='left' id=M_uwtSiteTree></div></nobr><input type=text id='uwtSiteTree_tb' class='ig_d1383a57_r8' style='overflow:hidden;position:absolute;left:0px;top:0px;cursor:text;display:none;' onblur="igtree_endedit(true);" value="" onkeydown="igtree_editKeyDown(event,'uwtSiteTree');" onkeyup="igtree_editKeyUp(event,'uwtSiteTree');" ondblclick="igtree_editClickHandler();" onclick="igtree_editClickHandler();"></div> </td></tr>
Notice how it added a style="display:none;" and a type="hidden". I didnt write that. Why does it add them? How can i get it to appear on the page?
Thanks
If I recall, the tree sets itself invisible until after the contents have finished loading, to prevent javascript errors from occuring before the browser has had a chance to fully load the HTML. My guess is that either your Javascript files aren't being loaded properly, or an error is being thrown in one of the WebTree's client events.
The quick way to check if the scripts are being loaded properly, is to use a tool like Fiddler, or WebDevelopmentHelper to trace the HTTP requests. You can also use Firebug for Firefox. Take a look at the files that are being loaded - specifically for any js file beginning with "ig". If you see a status code of "404", it means that your javascript files weren't found.
-Tony