I have a treeview on the left side of the screen which I need the PopulateOnDemand feature to be set on, this I have done, but I also need to update a grid in the right hand side of the screen at the same time when you click on a node, I have the OnItemPopulate method working fine, now the problem seems to be how to update the grid when ItemClick is fired, I need all this to happen on the Client, so the treeview RaiseServerEvents is false, at the moment the following code seems to work but I wanted to make sure this was the best way of making this happen:
I have the grid inside an UpdatePanel, this grid is triggered by the Button Click method.
TreeView
ClientSideAfterPopulate="RefreshGrid"
ClientSideOnItemClick = "OnItemClick"
Javascript code is:
Code: JavaScript
// TreeView Handle the OnItemClick
function OnItemClick(e, eventInfo) {
var node = eventInfo.getItem();
var nodeValue = node.getValue();
if (nodeValue != '') { // Empty is the Root Node.
// need to do a call back to get documents, this call back needs to
// be done without the whole page posting back.
var obj = document.getElementById('<%= text.ClientID %>');
obj.value = nodeValue;
setTimeout(function() {
RefreshGrid();
}, 10);
}
}
function RefreshGrid(treeView, node) {
var button = document.getElementById('<%= btnRefreshList.ClientID %>');
button.click();
}
I have tried other ways, but this seems to stop the ItemPopulate from working, any ideas on how to streamline this would be helpful,
Thanks
Simon.