I'm using an UltraWebTree and even though I turned the autopostback to false, I expand a branch on the tree and then another subbranch to reveal the children (reasons). After I select the reason, the web page does a post-back (as I said, I have all the post-backs turned to false....so that's confusing) and when I need to perform another action (such as a save of the information), I need the Node from the tree to determine all the parents and their cooresponding paths.
This control was working fine with the 5.3 version but since upgrading (for a .Net upgrade) to the 8.3 version, the node is no longer available (null).
Any helpful information would be appreciated.
Hello,
This definitely sounds weird. I did some tests on my own with the 8.3 version, but when AutoPostBack was set to false, the treeview did not postback in any of the cases I tried. Is there any way I can reproduce that locally? Can you please send your ASPX markup (and / or any relevant code behind) so we can reproduce the case?
I am just trying to figure out potential problems with the setup, e.g. AJAX, Load On Demand, Client-Side Events, etc - anything that could interfere with the treeview in any way.
Here's my html:
<ignav:UltraWebTree id="reasonCodesTreeView" runat="server" BorderStyle="Inset" BorderColor="#666666"
BackColor="Honeydew" BorderWidth="1px" Cursor="Default" WebTreeTarget="ClassicTree" Indentation="20"
Font-Size="9pt" Font-Names="Microsoft Sans Serif" ExpandImage="ig_treePlus.gif" CollapseImage="ig_treeMinus.gif"
EnableViewState="False" AutoPostBack=false Height="180px" Width="100%">
<SelectedNodeStyle Cursor="Default" BorderWidth="1px" BorderStyle="Solid" ForeColor="White" BackColor="#0099CC">
<Padding Bottom="1px" Left="2px" Top="1px" Right="2px"></Padding>
</SelectedNodeStyle>
<NodeEditStyle Font-Size="10pt" Font-Names="Microsoft Sans Serif"></NodeEditStyle>
<Levels>
<ignav:Level Index="0"></ignav:Level>
<ignav:Level Index="1"></ignav:Level>
<ignav:Level Index="2"></ignav:Level>
</Levels>
<Images>
<ExpandImage Url="ig_treePlus.gif" />
<CollapseImage Url="ig_treeMinus.gif" />
</Images>
<AutoPostBackFlags NodeChecked="False" NodeCollapsed="False" NodeDropped="False"
NodeExpanded="False" />
</ignav:UltraWebTree>
After I select the item on the tree (the lowest level of the tree), I need to click a button on the page to perform some other action. In the prior version of the control (5.3) and prior version of .Net (1.1), the node information is retained and am able to process the information. With this version, the node information gets lost.
The only thing the I notice here that could be causing the state loss problem is EnableViewState - if you have this property set to False, you need to rebind the treeview each time on postback. Maybe this has changed between 5.3 and 8.3 - so please check if you rebind the treeview or set EnableViewState to True - this could solve / alleviate the problem.
Hi. I'm new to using the Infragistics web controls and am having a very similar problem with the UltraWebTree. I am binding the tree to a dataset in the page_load event handler in codebehind (only when !IsPostBack). The tree is within a form but no other containing control (other than the page). EnableViewState is set to true on the page and the tree. All auto post back flags are set to false. The tree builds successfully and I can navigate the tree, expand, collapse, check nodes, etc. without problem. I have a button on my form that calls an event handler on the server. In that event handler the tree still has all of its nodes, but the data items are no longer bound to the nodes. The data key values are still there as are checked states, etc. but the data binding is lost. So far, I've gotten around this by saving the dataset I create in the page_load event handler into session and then using the data keys on the nodes to look the rows up in the dataset but I would like to understand why the databinding is lost.
I am using version 8.1.220081.1000 of Infragistics2.WebUI.UltraWebNavigator.v8.1
My code is below...
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" EnableViewState="true"%>
<%@ Register Assembly="Infragistics2.WebUI.UltraWebNavigator.v8.1, Version=8.1.20081.1000, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" Namespace="Infragistics.WebUI.UltraWebNavigator" TagPrefix="ignav" %><%@ Register Assembly="Infragistics2.WebUI.UltraWebGrid.v8.1, Version=8.1.20081.1000, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" Namespace="Infragistics.WebUI.UltraWebGrid" TagPrefix="igtbl" %><!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" enableviewstate="true"><head runat="server"> <title>My Prototype</title></head><body> <form id="form1" runat="server"> <ignav:UltraWebTree ID="UltraWebTree1" runat="server" CheckBoxes="True" EnableViewState="true" AutoPostBack="false"> <AutoPostBackFlags NodeChecked="False" NodeCollapsed="False" NodeDropped="False" NodeExpanded="False" /> </ignav:UltraWebTree> <table style="width: 100%;"> <tr> <td> <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Click Here" /> </td> </tr> </table> </form></body></html>
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { OleDbConnection cnn = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source='|DataDirectory|\mydata.mdb'"); OleDbDataAdapter da = new OleDbDataAdapter("Select * from Customers order by customer_name", cnn); DataSet ds = new DataSet(); da.Fill(ds, "Customers"); ds.Tables["Customers"].PrimaryKey = new DataColumn[] { ds.Tables["Customers"].Columns["ID"] }; da.SelectCommand.CommandText = "Select * from contract_areas order by customer_id, area_name"; da.Fill(ds, "Contract_Areas"); ds.Tables["Contract_Areas"].PrimaryKey = new DataColumn[] { ds.Tables["Contract_Areas"].Columns["AREA_ID"] }; ds.Relations.Add("CustAreas", ds.Tables["Customers"].Columns["ID"], ds.Tables["Contract_Areas"].Columns["CUSTOMER_ID"]);
UltraWebTree1.DataSource = ds.Tables[0].DefaultView; UltraWebTree1.Levels[0].RelationName = "CustAreas"; UltraWebTree1.Levels[0].ColumnName = "CUSTOMER_NAME"; UltraWebTree1.Levels[1].RelationName = "AreaStates"; UltraWebTree1.Levels[1].ColumnName = "AREA_NAME"; UltraWebTree1.DataMember = "Customers"; UltraWebTree1.Levels[0].LevelKeyField = "ID"; UltraWebTree1.Levels[1].LevelKeyField = "AREA_ID"; UltraWebTree1.DataBind();
//cnn.Close(); Session.Add("Dataset", ds); } }
protected void Button1_Click(object sender, EventArgs e) { foreach (Infragistics.WebUI.UltraWebNavigator.Node tnode in UltraWebTree1.Nodes) { if (node.Checked) //this is true { if (node.DataItem != null) System.Diagnostics.Debug.WriteLine("here"); //I never reach this line } } }
Thanks for sharing the solution in public forums - I am sure it will be appreciated by other developers. Even though it is different from version 2005.3, I am sure that this is the desired behaviour, since disabling the ViewState for the parent containers will disable the view state of child controls as well (and thus, the SelectedNode property as well).
Thanks again for sharing that in forums.
Here's the solution to the issue.
On the page itself, I had to set EnableViewState to true.
Then on the tree control I had to set EnableViewState to true.
And it was in a WebGroupBox, so I had to set EnableViewState to true.
Different than 5.3 but it's working now.