It is also a generally unstable browsing and development experience, but there's enough posts on that already.
I have the .Net AJAX RC installed. Create a simple AXAJ enabled web site, add a Label to display the selected node values, and a treeview using an xmldatasource. The XML has to be somewhat deeply nested to get the bug, about 6 levels deep. Wrap it all in an update panel and watch it explode when you try to navigate the tree.
protected void TreeView1_SelectedNodeChanged(object sender, EventArgs e)
{
this.TreeNodeValue.Text = TreeView1.SelectedNode.Value + "::" + TreeView1.SelectedNode.Text;
}
<body> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server" /> <asp:UpdatePanel ID="updTreeView" runat="server"> <ContentTemplate> <asp:Label ID="TreeNodeValue" runat="server" /> <div> <asp:XmlDataSource ID="dsTreeview" runat="Server" XPath="entity" DataFile="~/App_Data/ReportsTree.xml" /> <asp:TreeView ID="TreeView1" runat="Server" DataSourceID="dsTreeview" ExpandDepth="2" NodeIndent="8" OnSelectedNodeChanged="TreeView1_SelectedNodeChanged"> <RootNodeStyle CssClass="RootNode" /> <ParentNodeStyle CssClass="ParentNode" /> <LeafNodeStyle CssClass="LeafNode" /> <HoverNodeStyle CssClass="HoverNode" /> <SelectedNodeStyle CssClass="SelectedNode" /> <NodeStyle CssClass="Node" /> <DataBindings> <asp:TreeNodeBinding DataMember="entity" TextField="name" ValueField="SubjectID" PopulateOnDemand="true" ToolTipField="name" ImageToolTipField="ResourceType" /> </DataBindings> </asp:TreeView> </div> </ContentTemplate> </asp:UpdatePanel> </form></body>
<entity SubjectID="1" ResourceType="Company" ImageURL="images/ResourceIcons/Company.gif" name="Company"><entity SubjectID="2" ResourceType="Application" ImageURL="images/ResourceIcons/Application.gif" name="Impact Analysis"><entity SubjectID="3" ResourceType="Scope" ImageURL="images/ResourceIcons/assembly.gif" name="Horizon"><entity SubjectID="4" ResourceType="Namespace" ImageURL="images/ResourceIcons/namespace.gif" name="Bip.Horizon.Holding"><entity SubjectID="5" ResourceType="ClassList" ImageURL="images/ResourceIcons/Folder.gif" name="Classes"><entity SubjectID="6" ResourceType="Class" ImageURL="images/ResourceIcons/Class.gif" name="Bip.Horizon.Holding.Holding" Modifier="Public" ClassType="Class"><entity SubjectID="7" ResourceType="MethodList" ImageURL="images/ResourceIcons/Folder.gif" name="Methods"><entity SubjectID="8" ResourceType="Method" ImageURL="images/ResourceIcons/Method.gif" name=" 'BIP.Horizon.Holding.Holding.GetProfileMarketCapAllocations" Modifier="Public"><entity SubjectID="9" ResourceType="Return Type" ImageURL="images/ResourceIcons/Class.gif" name="Return Type" DataType="System.Data.DataTable"></entity><entity SubjectID="10" ResourceType="Argument List" ImageURL="images/ResourceIcons/Folder.gif" name="Arguments"><entity SubjectID="11" ResourceType="Argument" ImageURL="images/ResourceIcons/Column.gif" name="dsRebalanceAdjustedHoldingsByAccount" DataType="BIP.Horizon.Holding.RebalanceAdjustedHoldingsByAccountDS" type="BIP.Horizon.Holding.RebalanceAdjustedHoldingsByAccountDS" Modifier="ByRef"></entity><entity Modifier="ByRef" SubjectID="12" ResourceType="Argument" ImageURL="images/ResourceIcons/Column.gif" name="dsProductMarketCapRange" DataType="BIP.Core.Product.ProductMarketCapRangeDS" type="BIP.Horizon.Holding.RebalanceAdjustedHoldingsByAccountDS"></entity><entity Modifier="ByRef" SubjectID="13" ResourceType="Argument" ImageURL="images/ResourceIcons/Column.gif" name="intMarketCapRangeID" DataType="int" type="int"></entity></entity><entity SubjectID="14" ResourceType="Call List" ImageURL="images/ResourceIcons/Folder.gif" name="Callers"><entity SubjectID="15" ResourceType="Method" ImageURL="images/ResourceIcons/Method.gif" name="BIP.Horizon.Web.UI.Account.aspx.cs"></entity></entity><entity SubjectID="16" ResourceType="Callee List" ImageURL="images/ResourceIcons/Folder.gif" name="Callees"><entity SubjectID="17" ResourceType="Method" ImageURL="images/ResourceIcons/Method.gif" name="BIP.Horizon.Product.GetMarketCapRanges"></entity></entity><entity SubjectID="18" ResourceType="Data Object List" ImageURL="images/ResourceIcons/Folder.gif" name="Data Objects"><entity SubjectID="19" ResourceType="DataObject" ImageURL="images/ResourceIcons/Database.gif" name="spbip.Horizon.Product.GetMarketCapRanges"></entity></entity></entity></entity></entity></entity></entity></entity></entity></entity>
The treeview control is not supported in the updatepanel by the docs. I hope this will be change in the future or we'll get a new real ajax treeview. I am using the treeview in updatepanel since the first ctps. I have some problems with it (for example with EnableClientScript="true"), but with some hacks it works for me.
The main problem for me that the treeview+updatpanel could be very slow, because the treeview needs enableviewstate="true" to works properly.
First I world try to turn off any extra on the treeview especially this:
PopulateOnDemand="true" ->PopulateOnDemand="false"I didn't try your code by I suppose that populating the nodes on the client side then expanding/collapsing/selecting a node could be easilystay out of the sync with the viewstate/server side.That was my problem with EnableClientScript="true".
No comments:
Post a Comment