I'm currently using 2008.1 and I have a webtree inside of a splitter, inside of an ajax update panel that also uses a master page. When I initially load the page, I'm dynamically loaded the various nodes and then selecting a specific node by setting treeview.selectednode property. When the page renders, the SelectedNodeStyle does not get applied. If I then do something to generate a postback, the SelectedNodeStyle then gets applied.
My attempts to duplicate the issue using a simple page with an update panel and just the webtree does not reproduce the issue. Does anyone know of any known issues like this. I'm also getting the same issue with the WebGrid in the same page. The RowStyleDefault, RowAlternateStyleDefault, and HeaderStyleDefault do not get applied unless a post back occurs.
Any assistance would be appreciated.
Best Regards,Dale
Hello,
Could you please send a little bit more information about the tree declaration. ASPX declaration, code-behind or sample project – anything that can get us started is welcome. There can be many reasons for that issue.
Thanks.
Thanks Ivan, I completely understand. It's hard to test what you can't see. Unfortunately, I haven't been able to reproduce in a simplified project and I can't really upload the whole thing. So, I'll give you what I can. Remember, I'm working with 2008.1 (no hotfixes or patches) and I'm targeting the 2.0 framework with Visual Studio 2008.
Below the Register Assembly directive (I included it so you could see the version information) is the declaration for the Tree, some of the code behind and some of the javascript. The tree is declared inside a splitterpane, which is inside an ajax updatepanel. I'm also using a MasterPage and the page with the tree is a content page.
If you need anything else, just let me know what you want to see. I wouldn't mind upgrading to 2008.3 if I knew it would solve the problem. I'm just hesitant to do that as an initial step because in the past I upgraded to a more recent version to solve one problem and the newer version actually introduced a few new problems.
So, with all that in mind, take a look and see what you think.
Any assistance is certainly appreciated.
<%@ Register Assembly="Infragistics2.WebUI.UltraWebNavigator.v8.1, Version=8.1.20081.1000, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" Namespace="Infragistics.WebUI.UltraWebNavigator" TagPrefix="ignav" %>
<ignav:UltraWebTree ID="tvwAccounts" runat="server" LoadOnDemand="Manual" WebTreeTarget="ClassicTree" Indentation="20" CssClass="basePakInfoFont"> <Images> <ParentNodeImage Url="~/images/folderclosed.gif" /> <LeafNodeImage Url="~/images/indexcardorange.gif" /> </Images> <ClientSideEvents NodeClick="tvwAccounts_NodeClick" InitializeTree="tvwAccounts_InitializeTree" /> <SelectedNodeStyle BackColor="#F2F2E6" ForeColor="#FF5500" Font-Bold="True" /></ignav:UltraWebTree>
The code below gets called from PageLoad if it's not a postback.
Private Sub InitializeUI() If Page.Request.QueryString("countryId") IsNot Nothing AndAlso _ Page.Request.QueryString("countryId") <> Guid.Empty.ToString Then For Each countryNode As Node In tvwAccounts.Nodes Dim tag As ExplorerTag = DirectCast(countryNode.Tag, ExplorerTag) If tag.NodeType = ExplorerTag.NodeTypes.Country AndAlso _ tag.RootNodeValue = New Guid(Page.Request.QueryString("countryId")) Then If Page.Request.QueryString("territoryId") IsNot Nothing Then loadNode(countryNode) For Each territoryNode As Node In countryNode.Nodes Dim territoryTag As ExplorerTag = DirectCast(territoryNode.Tag, ExplorerTag) If territoryTag.NodeType = ExplorerTag.NodeTypes.Territory AndAlso _ territoryNode.Text = Page.Request.QueryString("territoryId") Then If Page.Request.QueryString("accountId") IsNot Nothing Then loadNode(territoryNode) For Each accountNode As Node In territoryNode.Nodes If accountNode.Tag.ToString = Page.Request.QueryString("accountId") Then loadNode(accountNode) tvwAccounts.SelectedNode = accountNode If Page.Request.QueryString("quoteId") IsNot Nothing Then For Each pakRow As UltraGridRow In grdPaks.Rows If pakRow.Cells(0).Value.ToString = Page.Request.QueryString("quoteId") Then pakRow.Selected = True pakRow.Activate() End If Next End If Exit For End If Next Exit For Else loadNode(territoryNode) tvwAccounts.SelectedNode = territoryNode Exit For End If End If Next Exit For Else loadNode(countryNode) tvwAccounts.SelectedNode = countryNode Exit For End If End If Next End If End Sub
Private Sub loadNode(ByVal selectedNode As Node) If selectedNode.Tag.GetType Is GetType(String) Then GetAccountQuotes(New Guid(selectedNode.Tag.ToString)) BindToGrid() End If ' Here we need to expand or contract the ' tree as necessary. If selectedNode.ShowExpand Then If selectedNode.Expanded = False Then If selectedNode.Nodes.Count = 0 Then If selectedNode.Tag.GetType Is GetType(ExplorerTag) Then Select Case DirectCast(selectedNode.Tag, ExplorerTag).NodeType Case ExplorerTag.NodeTypes.Country LoadTerritories(selectedNode) Case ExplorerTag.NodeTypes.Territory LoadAccounts(selectedNode) End Select End If End If selectedNode.Expand(False) Else selectedNode.Collapse(False) End If End If End Sub
Here is some of my javascript code.
var accountTree;
function tvwAccounts_InitializeTree(treeId) { try { accountTree = igtree_getTreeById(treeId); } catch (ex) { alert('Error in Tree initialize' + ex.message); } }
function tvwAccounts_NodeClick(treeId, nodeId, button) { //Add code to handle your event here. try { //alert("nodeclick"); if (!nodeId || !treeId || !button) return null; if (button == 2) { var node = igtree_getNodeById(nodeId); if (node && accountTree) { // Initialize menu for working with the tree. var menuItems = new Array(); menuItems = mnuQuoteContext.getItems(); loadMenuForTree(menuItems); // Account nodes will have an account id stored in its tag. // All other nodes (ie country and territory) will have a null tag. var tag = node.getTag(); if (tag) { accountId = tag; quoteId = null; // We need to ensure menuitems are enabled for account nodes. for (var i = 0; i < menuItems.length; i++) { if (menuItems[i].getElement().style.display == 'block') { menuItems[i].setEnabled(true); } } if (tag == '00000000-0000-0000-0000-000000000000') { menuItems[0].setTargetUrl('CreateQuote.aspx'); hideMenuItem(menuItems[7]); hideMenuItem(menuItems[9]); } else { menuItems[0].setTargetUrl('CreateQuote.aspx?AccountID=' + tag); var id = tag.split('-'); var idWithOutSeparators = ''; for (var i = 0; i < id.length; i++) { idWithOutSeparators += id[i]; } showMenuItem(menuItems[7]); showMenuItem(menuItems[9]); menuItems[9].setTargetUrl('Accounts.aspx?action=edit&id=' + idWithOutSeparators); }
//these will need to be implemented at some point menuItems[6].setEnabled(false); menuItems[11].setEnabled(false); } else { // Menuitems should only be enabled for account nodes, so // we disable all visible nodes for country or territory nodes. for (var i = 0; i < menuItems.length; i++) { if (menuItems[i].getElement().style.display == 'block') { menuItems[i].setEnabled(false); } //menuItems[0].setTargetUrl('CreateQuote.aspx'); } } // Cancel the show of IE context menu event.returnValue = false; event.cancelBubble = true; igmenu_showMenu(mnuQuoteContext.MenuName, event); } } } catch (ex) { alert('Error in Treeview Click' + ex.message); }}
Well, I finally bit the bullet and upgraded to 2008.3 to see if it would resolve these problems and I'm glad to say that on the surface it appears to have resolved the problems. A bit more extensive testing will see if the upgrade broke anything else.
Just thought I would share,Dale
BTW - Another bit of information. None of the styles on any of my infragistics controls are getting applied during an initial page load. I have the tree control, a grid, and a popup menu and none of the default styles are getting applied. Just thought that might help narrow it down.
Thanks again,Dale
Hey Ivan,
Any idea on this one? You mention there are many reasons why this can happen. Can you give me some of these reasons? I can then go see if any apply to my scenario. Are there any known issues with 2008.1 targeting framework 2.0? Are there fixes for these types of issues in 2008.3? I thought I would hit the forums before opening a support incident, but I can certainly do that if necessary.
As always, any assistance is certainly appreciated.