Monday, March 26, 2012

TreeView populated programatically in Atlas UpdatePanel

Hi there,

I'm fairly new to Atlas and ASP.NET, so perhaps this question is obvious (I apologise).

I have created a page which essentially contains this information:

<asp:Content ID="Content1" ContentPlaceHolderID="MainPagePlaceholder" Runat="Server">
<atlas:UpdatePanel ID="AjaxMultiMediaPanel" mode="Conditional" runat="server">
<ContentTemplate>
<asp:Table ID="MultiMediaTable" CssClass="MultiMediaTable" runat="server" Height="193px" Width="274px">
<asp:TableRow runat="server">
<asp:TableCell runat="server" CssClass="TableTopAlign">
<cc1:MediaPlayer ID="MediaPlayer1" runat="server"></cc1:MediaPlayer>
<atlas:UpdateProgress runat="server" ID="progress">
<ProgressTemplate>
<asp:Image ID="Image1" runat="server" ImageUrl="~/images/SpinningBall.gif" /> Reading UPnP Directory
</ProgressTemplate>
</atlas:UpdateProgress>
</asp:TableCell>
<asp:TableCell runat="server" CssClass="TableTopAlign">
<asp:TreeView ID="TreeView1" runat="server" >
<ParentNodeStyle CssClass="TreeParentNodeStyle" />
<HoverNodeStyle CssClass="TreeHooverStyle" />
<RootNodeStyle CssClass="TreeRootNodeStyle" />
<LeafNodeStyle CssClass="TreeLeafStyle" />
<NodeStyle CssClass="TreeNodeStyle" />
</asp:TreeView>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow runat="server">
<asp:TableCell runat="server">
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Play" />
<asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="Load UPnP Info" />
</asp:TableCell>
<asp:TableCell>
<asp:Label ID="Label1" runat="server" Text="" />
</asp:TableCell>
</asp:TableRow>
</asp:Table>
</ContentTemplate>
</atlas:UpdatePanel
</asp:Content>

When Button2 is pressed, I programatically populate the TreeView (using c# to recursively build the tree). This works without problems when I do NOT use Atlas, except of course in that case the page refreshes after about 10 seconds. Now, using the code above, The Progress Update image and text is shown for about 10 seconds, but after that the page 'freezes' for over a minute. I have tried triggers to force a refresh, programatically forcing a refresh, but nothing helps. If I at the end of my tree-population code turn set TreeView1.Visible = false; then the page does not freeze.


It appears that the population of the treeview somehow causes Atlas to do 'something' for an awful long time.

If possible, I would appreciate any help any of you experts can offer.

- Anders

P.S. The tree has a depth of about 4-5 levels max, with about 100 items. Nothing crazy. The 10 second delay is due to some other UPnP lookups I'm doing, not because it takes a long time to build the tree.

See also:similar discussion

A count of my items reveals 2685 of them, a bit more than stated above.


Hi Anders

Did you ever find out a solution to this problem? I have been having the same problem where a TreeView inside an UpdatePanel takes a very long time to refresh.

Using Fiddler, I found out that the problem is the various images used by the TreeView control. Outside an UpdatePanel, the browser makes only one request for an image, regardless of the number of times its used. Inside the UpdatePanel, the browser makes a request for each and every instance of an image.

I don't know if this is a problem with the IE cache or the way Atlas is processing the resulting page.

The solution to this has so far eluded me. The only thing I can do is to reduce the number of images used by the TreeView control, but that quickly makes it useless.

Cheers,

- Dan


Hi Dan,

No solution so far. I had to drop it and just create the site using other widgets. Not quite as cool, but at least it works.


http://ajax.asp.net/docs/overview/UpdatePanelOverview.aspx#UpdatePanelCompatibleControls

I had same problem. Finally, I setup a full postback trigger to the control that will force the repaint.
In my case, I had a button so my trigger code look like this:
<Triggers>
<asp:PostBackTriggerControlID="btnBack"/>
<asp:PostBackTriggerControlID="btnNext"/>
</Triggers>


I had the same problem, but I am still using Atlas, I don't wanna update until official version. And atlas UpdatePanel does not have PostBackTrigger, do you know how to solve it this problem witt Atlas?
If you haven't upgraded to the latest version by now, then you're going to be in a world of hurt when the RTM is released. There have been MANY breaking changes from ATLAS and it would be wise to forget ATLAS and move forward.

No comments:

Post a Comment