Search code examples
c#asp.netasp.net-ajaxtreeviewupdatepanel

tree view Hierarchy is not working properly in side the Update panel


I am using a Tree View Hierarchy inside the UpdatePanel. The ASP.NET code is:

<asp:UpdatePanel ID="UpdatePanel1" runat="server" ChildrenAsTriggers="true" UpdateMode="Conditional">
    <ContentTemplate>
        <asp:TreeView ID="HierarchyTreeView" runat="server" meta:resourcekey="HierarchyTreeViewResource1" EnableViewState="true"></asp:TreeView>
    </ContentTemplate>
</asp:UpdatePanel>

and on code behind i am writing

protected override void OnInit(EventArgs e)
{
        base.OnInit(e);
        HierarchyTreeView.PathSeparator = CaseListPresenter.PathSeparator;
        HierarchyTreeView.TreeNodePopulate += new TreeNodeEventHandler(HierarchyTreeView_TreeNodePopulate);
        HierarchyTreeView.SelectedNodeChanged += delegate {
            Presenter.CancelChangeFlag(); 
            Presenter.SelectedNodeChanged(); 
            CheckPreview(); 
        };
}

If I am using TreeView outside the UpdatePanel my OnInit is working well. But, if I am using TreeView inside the UpdatePanel, it is not working properly. I want to maintain the scroll position of my tree view


Solution

  • Now finally i got the solution with this..

    Maintain Panel Scroll Position On Partial Postback ASP.NET