Hi
Scenario:
I have an treeview that is being loaded on the PageLoad from the DataBase.
First it fills the first root nodes then each nodeExapand event fetch the new nodes from the database.
Performance here is critical, so what I did a Ajax request with the RadAjaxManager send some parameters to the database and response back to the client, if it is successful I finish the client side operation:
Server Code:
Client Code:
I have to disable the EnableViewState to increase performance. I used Fiddler to measure the transfered data:
EnabaleViewState = true : 92.175 Bytes
EnabaleViewState = false : 1.149 Bytes (hurray!)
However (I hate howervers!), when EnabaleViewState is false, only the first root nodes are loaded, and when I try to expand a root node to show the child nodes this error appears:
"Index was out of Range. Must be non-negative and less the size of the collection.
Parameter name: Index".
Searching the telerik forums I found that if you disable the PersistLoadOnDemandNodes it will increase perfomance, but it didn't make any difference really.
EnableViewState = true
PersistLoadOnDemandNodes = false : 92.275 Bytes.
But with "EnableViewState = true" and "PersistLoadOnDemandNodes = false" the tree worked fine wiht no "Index was out of Range" javascript error.
However ( ¬¬ ), when EnableViewState is set to false the nodes are not persisted on the server and I can't check if a node has a father on the server, treeNode (captured from the RadTreeNodeEventArgs) has always parentNode = null.
So, how can I check the parentNode property with EnableViewState False? Im not sure how it will lower the performance loading everything every time in the PageInit event.
Thanks!
Scenario:
I have an treeview that is being loaded on the PageLoad from the DataBase.
First it fills the first root nodes then each nodeExapand event fetch the new nodes from the database.
Performance here is critical, so what I did a Ajax request with the RadAjaxManager send some parameters to the database and response back to the client, if it is successful I finish the client side operation:
Server Code:
protected void RadAjaxManager_AjaxRequest(object sender, AjaxRequestEventArgs e) |
{ |
string argument = e.Argument; |
string operation = GetOperation(argument); |
string parameters = RemoveOperation(argument); |
switch (operation) |
{ |
case "0": |
MoveMenuItemToMenu(parameters); |
break; |
} |
private void MoveMenuItemToMenu(string argument) |
{ |
string[] nodes = argument.Split('|'); |
string sourceMiId = nodes[0]; |
string destMeId = nodes[1]; |
bool dbResult = MenuItemDAO.Create().MoveMenuItemToMenu(sourceMiId, destMeId); |
RadAjaxManager.ResponseScripts.Add(string.Format("FinishMoveMenuItemToMenu({0})", dbResult.ToString().ToLower() )); |
//System.Threading.Thread.Sleep(3000); |
} |
Client Code:
function MoveMenuItemToMenu(srcNode,dstNode) |
{ |
var sourceNodeId = GetId(srcNode.get_value()); |
var destNodeId = GetId(dstNode.get_value()); |
tempSourceNode = srcNode; |
tempDestNode = dstNode; |
var arg = "0?" + sourceNodeId + "|" + destNodeId; |
sendRequest(arg); |
} |
function sendRequest(params) |
{ |
var ajaxMan = $find("RadAjaxManager"); |
ajaxMan.ajaxRequest(params); |
} |
function FinishMoveMenuItemToMenu(success) |
{ |
if (success) |
{ |
tempSourceNode.get_parent().get_nodes().remove(tempSourceNode); |
tempDestNode.get_nodes().add(tempSourceNode) |
}else |
alert('Operation in database did not occur'); |
} |
I have to disable the EnableViewState to increase performance. I used Fiddler to measure the transfered data:
EnabaleViewState = true : 92.175 Bytes
EnabaleViewState = false : 1.149 Bytes (hurray!)
However (I hate howervers!), when EnabaleViewState is false, only the first root nodes are loaded, and when I try to expand a root node to show the child nodes this error appears:
"Index was out of Range. Must be non-negative and less the size of the collection.
Parameter name: Index".
Searching the telerik forums I found that if you disable the PersistLoadOnDemandNodes it will increase perfomance, but it didn't make any difference really.
EnableViewState = true
PersistLoadOnDemandNodes = false : 92.275 Bytes.
But with "EnableViewState = true" and "PersistLoadOnDemandNodes = false" the tree worked fine wiht no "Index was out of Range" javascript error.
However ( ¬¬ ), when EnableViewState is set to false the nodes are not persisted on the server and I can't check if a node has a father on the server, treeNode (captured from the RadTreeNodeEventArgs) has always parentNode = null.
So, how can I check the parentNode property with EnableViewState False? Im not sure how it will lower the performance loading everything every time in the PageInit event.
Thanks!