Hi,
I've been trying to get the tree object using the client side model but I encounter the following problem:
When I have the tree inside a WebTab I can't get the tree object whereas when I have the tree outside the WebTab I can use get it without a problem.
function test(){var tree = igtree_getTreeById('<%=mytree.ClientID%>');}
Any ideas? I have to avoid the server side code since I have to avoid postbacks as much as possible.
Regards,
Thanasis
Hello,
Thank you very much for the solution! It worked just fine.
After consulting with some of my colleagues, it turns out that this is an issue that has come up before. It's not something I'd personally seen before, or I'd have mentioned it earlier.
The igtree_getTreeById() function does not work with underscores. This can cause some confusion when your tree is in a naming container (such as WebTab or a master page). Changing this on our end would not only break backward compatibility for existing applications, it would also very likely destabilize the code base.
There are two solutions to this issue.
The first solution is to strip out the underscores from what you send to the igtree_getTreeById() function: var id = "<%= insidetab.ClientID %>"; var tree = igtree_getTreeById(id.replace(/_/g, "")); alert(tree);
The other solution is to use the tree's Initialize client-side event to capture the ID that it expects to use, and pass this to the igtree_getTreeById() function instead of the tree's server-side ClientID property.
Thanasis,
Thanks for the source page text, as this was very helpful in taking the next steps to figuring out what's happening. I'm able to reproduce the behavior you've described, and I don't believe that this behavior is correct.
I've passed this information to Developer Support, who will create a support case for you and will assist further.
I place the controls directly in the ContentTemplate.
Here is the source for a test page.
<%@ Page Language="C#" AutoEventWireup="true" %>
<%@ Register assembly="Infragistics35.WebUI.UltraWebTab.v9.1, Version=9.1.20091.1015, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" namespace="Infragistics.WebUI.UltraWebTab" tagprefix="igtab" %><%@ Register assembly="Infragistics35.WebUI.UltraWebNavigator.v9.1, Version=9.1.20091.1015, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" namespace="Infragistics.WebUI.UltraWebNavigator" tagprefix="ignav" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title>Untitled Page</title><script language="javascript" type="text/javascript"><!--
function Button1_onclick() {alert(igtree_getTreeById('<%=insidetab.ClientID%>'));}
function getfreetree_onclick() {alert(igtree_getTreeById('<%=freetree.ClientID%>'));}
// --></script> <style type="text/css"> .style1 { width: 100%; } .style2 { width: 330px; } </style></head><body> <form id="form1" runat="server">
<table class="style1"> <tr> <td class="style2"> <igtab:UltraWebTab ID="UltraWebTab1" runat="server"> <Tabs> <igtab:Tab Key="ttree" Text="TestTree"> <ContentTemplate> <ignav:UltraWebTree ID="insidetab" runat="server" DefaultImage="" HoverClass="" Indentation="20"> <Levels> <ignav:Level Index="0" /> <ignav:Level Index="1" /> </Levels> <Nodes> <ignav:Node Text="Root Node" Expanded="True"> <Nodes> <ignav:Node Text="Child Node"> </ignav:Node> </Nodes> </ignav:Node> </Nodes> </ignav:UltraWebTree> </ContentTemplate> </igtab:Tab> </Tabs> </igtab:UltraWebTab> </td> <td> <ignav:UltraWebTree ID="freetree" runat="server" DefaultImage="" HiliteClass="" HoverClass="" Indentation="20" Width="223px"> <Levels> <ignav:Level Index="0" /> </Levels> <Nodes> <ignav:Node Text="Root Node" Expanded="True"> <Nodes> <ignav:Node Text="Child Node"> </ignav:Node> <ignav:Node Text="Child Node"> </ignav:Node> </Nodes> </ignav:Node> </Nodes> </ignav:UltraWebTree> </td> </tr> <tr> <td class="style2"> <input id="gettreeintab" type="button" value="TreeInTab" onclick="return Button1_onclick()" /></td> <td> <input id="getfreetree" type="button" value="FreeTree" onclick="return getfreetree_onclick()" /></td> </tr> </table> </form> <p> </p></body></html>
I've moved this thread to the WebTree forum.
A question about the setup of your WebTab: how are you setting up your tabs? Are you using TargetURL, UserControlURL, or placing controls directly in the ContentTemplate?