lundi 11 mai 2015

Why does ASP.NET TreeView node expanding only works on page load?

I am populating an ASP.NET (VB) TreeView with data from a database. While populating the tree, I programmatically expand specific nodes based on their data. The node expansion is completed correctly when called for non-postbacks but not for postbacks after a button click. I am thinking that the page lifecycle is resetting the formatting somehow on button postbacks. Does anyone know how I can populate the TreeView nodes with formatting intact for button postbacks?

'Formatting intact
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    loadTreeView("MyTree")
End Sub

'Formatting not intact
    Public Sub btnLoadHierarchy_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnLoadHierarchy.Click
            loadTreeView("MyTree")
    End Sub

Aucun commentaire:

Enregistrer un commentaire