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; } } }
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.”
Yeah that is absolutly fine. I know this.If you see my question, i said EnableViewState works fine. I could not see any sample on the site which describes to maintain the state in false state.
Ok..let me put the question again in this case...can you(anyone) give me an example here to maintain the state of the tree in case EnableViewState set to false as it would be the application's responsibility to maintanin the state.
Thanks for the reply anyhow...
Raj
Inorder to maintain state you could make use of hidden fields and keep track of what you updated.
Then on postback, reapply these updates to the webtree in the InitializeTree client side event
let me take some time and review your code.