I have a 2 level webDataTree that I want to do some processing on the server when the user clicks on the child nodes. However when they click on the parent node I don't want the postback to happen.
Is there a way to cancel the server side clicked event? Can I do something like handle the client click and use that to abort?
The only real thing I need to ensure is that I send the node.tag data back to the server as that is the key for my logic to process.
Thanks
jack
Hi,
the WebDataTree has NodeClick event on the client side and on the server side. Of course the click events can not be canceled. It's like you can't cancel a mouse click on your desktop - it just happens. The important thing is how do you process the click. So you can set Enabled = false to all parent nodes. This way the user will be able to expand/collapse the parents, but no events will be fired for those nodes.
To my understanding you have configured autopost back on NodeClick and you do not want to go to the server when an unneeded node is clicked. You can disable autopostback and do manual postback when the right node has been clicked.
Hope this helps.
Thanks,
Lubomir
Lubomir,
The enabled/disabled did the trick beautifully and should be okay for most of our business cases. I think I will be able to set the enabled/disabled from my businesObject in almost every scenario. I was actually in Silverlight mode with my question about handling the clicked event. I was thinking maybe if it was flagged as handled in the client then it wouldn't call the server.
In the scenario where I have to make the decision at the client level how would I trigger the manual postback? Would that be in the client Clicked event?
Thank you very much!
You could do the following in the client side NodeClick
__doPostBack(sender._id, "NodeClick" + (args._getPostArgs ? args._getPostArgs() : ''));
this will do a full page postback. But this is more like a hack, so I would suggest to use the first approach.
Lubo