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
835
Updating WebTree in UpdatePanel through ICallBackEventHandler
posted

I have a tree in an UpdatePanel that through standard event manipulation (i.e., DemandLoad, NodeCollapsed, etc.) works beautifully. I need to update the tree based upon a call through the ICallBackEventHandlerbased upon other actions that occur.

Let me explain further.

My app has 2 frames, 1 containing a WebTree, the other containing a VirtualEarth map.  Data is posted on the map based upon tree selection, and as the map is panned the tree needs to get updated.  Upon completion of the Map panning, I make a call back to the tree frame to update the tree.  In the tree page, I make an ICallBackEventHandler calling the Tree Page  to refresh the tree.

I was doing all this in JavaScript, but Tree manipulation was slow.  Therefore, I'm trying to do on the server.  I want to add / delete nodes from the tree and repost. 

I have an UpdataPanel.Update() (the UpdataPanel UpdateMode is Conditional) at the end of the routine which modifies the tree, but it is not reposting the panel.

Suggestions???  Thanks much!

 

Parents
No Data
Reply
  • 835
    Verified Answer
    posted

    So I research it a bit more and come up with my own answer, as follows:

    1.  No way to do it directly.
    2.  So...Fire and AsynchPostback from Javascript instead ICallBack.  See the following article:   Easily refresh an UpdatePanel, using JavaScript.

    Breaking it down further and varying from the documented workaround, in my Javascript I do a

    __doPostBack("UpdatePanel1", "SetTree::" + params)

    In the PageLoad, I do: 

    strTarget = Request("__EventTarget")
    If Not strTarget Is Nothing AndAlso strTarget.EndsWith("UpdatePanel1") Then
       
    strRequest = Request("__EventArgument")
       
    If Not strRequest Is Nothing AndAlso strRequest <> "" Then
            RaiseCallbackEvent(strRequest)
       
    End If
    End If

    In the RaiseCallbackEvent routine, I make all the necessary changes to the tree and it posts back cleanly and partially.

    This works beautifully!!!

Children
No Data