Thursday, August 13, 2009

Tip: Maintaining Scroll Position of TreeView via Ajax

Update Panel will solve the problem of maintaining the scroll position of treeview in a div

Place the treeview inside and update Panel. The sample structure is as follows.


<div id="TreeDIV" runat="server" style="overflow:auto">
<asp:UpdatePanel ID="PnlTree" ChildrenAsTriggers="true" runat="server">
<ContentTemplate>
<fieldset>
<asp:TreeView ID="Treeview1"
runat="server"
SelectedNodeStyle-ForeColor="White"
SelectedNodeStyle-BackColor="Navy"
OnSelectedNodeChanged="Treeview1_SelectedNodeChanged">
<Nodes>
<%-- Dynamically constructing the treeview from code behind --%>
</Nodes>
</asp:TreeView>
</fieldset>
</ContentTemplate>
</asp:UpdatePanel>
</div>


Digg Google Bookmarks reddit Mixx StumbleUpon Technorati Yahoo! Buzz DesignFloat Delicious BlinkList Furl

0 comments : on " Tip: Maintaining Scroll Position of TreeView via Ajax "