Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
85
WebDataTree Async PostBack NodeClick
posted

Hello,

We have a webpage that has three key sections: a title section at the top, and below that a tree on the left and content on the right.

The tree contains categories and products, and is bound to a WebHierarchicalDataSource so that you have your root categories and different layers of categories below that with the products being at the lowest level. These nodes were turned into hyperlinks that would go to either a category listing or a product listening depending on what type of node you clicked on.

I am wanting to change that functionality to do an async postback and have the content section be inside of an update panel.
I have managed to get it to work fine by doing a regular postback and handling the changes to the updatepanel in the nodeclick event, but whenever I try doing it as an async callback the updatepanel will not refresh. 

I can place a breakpoint in the code, both the Page_Load event and the NodeClick event fire, the code that updates the updatepanel fires, but when it gets returned to the browser the updatepanel doesn't change.

I am not sure if there is something wrong with how the tree is doing its postback that is not triggering the update for the updatepanel, or if I did something wrong with the updatepanel so it isn't catching the async postback. It worked fine on a regular postback.

I tried changing the type of updatepanel between conditional and always with no results, tried switching events to watch for on the tree to SelectionChanged but that didn't seem to work either. I noticed that scriptmanager.IsInAsyncPostback seems to always be false and I believe it should be true when the tree does an async postback.

Below is the markup for the tree and the update panel. I'm not sure if you'll be able to spot anything right off from that or not. If needed I will try to set up a simple project with just the tree and updatepanel in it to upload.

<ig:WebDataTree ID="itemtree" class="ItemTree" runat="server"
DataSourceID="hdsItem" SelectionType="Single"
NodeIndent="10" InitialDataBindDepth="1">
<AutoPostBackFlags SelectionChanged="Async" />
<DataBindings>
<ig:DataTreeNodeBinding DataMember="dsItemCategoryRoot_DefaultView"
KeyField="CategoryID" TextField="Description" ValueField="CategoryID"
TargetField="Category" />
<ig:DataTreeNodeBinding DataMember="dsItemCategory_DefaultView"
KeyField="CategoryID" TextField="Description" ValueField="CategoryID"
TargetField="Category" />
<ig:DataTreeNodeBinding DataMember="dsItem_DefaultView" KeyField="InventoryID"
TextField="Name" ValueField="InventoryID" TargetField="Inventory" />
</DataBindings>
</ig:WebDataTree>

<asp:UpdatePanel ID="upContent" runat="server">
<ContentTemplate>
<asp:PlaceHolder runat="server" ID="phContent"
EnableViewState="false" />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="itemtree" EventName="SelectionChanged" />
</Triggers>
</asp:UpdatePanel>