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
504
Ultrawebtree NodeCliecked does not fire in case of DemandLoad event and tree disapperas from the ASPX page
posted

Hi,

 

I am trying to use the DemandLoad event using the basic Tree with EnableViewState set to false and LoadOnDemand set to ManualSmartCallbacks. (This requirement for load on demand i read on your site, if i set the EnableViewState to TRUE then everything works good)

 

<ignav:UltraWebTree ID="UltraWebTree1" runat="server" Height="197px"
                                         LoadOnDemand="ManualSmartCallbacks"
                        EnableViewState="false" AutoPostBack="true" ondemandload="UltraWebTree1_DemandLoad"
                        onnodeclicked="UltraWebTree1_NodeClicked" >
                    </ignav:UltraWebTree>

 

and following code load the nodes on demand

 

 protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            UltraWebTree1.Nodes.Add("Rajan").ShowExpand = true;
           }
    }
    protected void UltraWebTree1_DemandLoad(object sender, Infragistics.WebUI.UltraWebNavigator.WebTreeNodeEventArgs e)
    {
        if (Page.IsPostBack)
        {
            Random rand = new Random();
            int nextRandom = rand.Next(12);

            for (int i = 0; i <= nextRandom; i++)
            {
                Node newNode = new Node();
                newNode.Text = "NewNode" + i;
                newNode.LoadOnDemand = true;
                e.Node.Nodes.Add(newNode);
                UltraWebTree1.Nodes.Add(e.Node).ShowExpand = true;
            }
           
        }
    }

 

Parents
  • 28407
    posted

    HI,

      This is normal behaviour.

     The problem in this situation has to do with the state management of the control.  That is, EnableViewState is set to false, so whatever is databound in one postback is lost for the next.  So the items in the tree are not being reloaded when the page posts back for the NodeClicked event.  So no event can fire for a node that does not exist.  If you turn on ViewState, the event fires.  If ViewState cannot be turned on, then the state of the tree Nodes becomes the responsibility of the application, which must reload them properly in order for the NodeClicked event to be able to function.  Again, WebTree in this sample is totally stateless, so the nodes being added in the Manual load on demand are not being added permanently.”

     

Reply Children