Events
We need to update the changes into the database after each action.
We'll use the ASPTreeView server-side events
To update the database without reloading the page, the AJAXPage control will be used.
Using this control we can send a number of variables to a server-side page for processing
(e.g. the id of the edited node, its new text etc.)
We need to specify which events should be handled on the server-side.
For this example, only 4 events will be handled:
oTree.EventList = "OnNodeEdit,OnAddNode,OnNodeDrop,OnRemoveNode";
All the client-side events are implemented in the ob_events_xxxx.js file
(located in the tree2/script folder).
For example, the OnNodeEdit client-side event:
function ob_OnNodeEdit(id, text, prevText)
{
if(ob_ev("OnNodeEdit"))
{
if(typeof ob_post == "object")
{
ob_post.AddParam("id", id);
ob_post.AddParam("text", text);
ob_post.AddParam("prevText", prevText);
//Change "cs_TreeEvents.aspx" with the name of your server-side processing file
ob_post.post("cs_TreeEvents.aspx", "OnNodeEdit");
}
else
{
alert("Please add obout_AJAXPage control to your page to use the server-side events");
}
}
}
In this function the ob_post object was used (this is the AJAXPage client-side object).
We are preparing 3 variables to be sent to the server: the id of the node, its new text and its
previous text. These variables are created using the AddParam method.
Finally, the created parameters are sent to the cs_TreeEvents.aspx page for processing
using the post method.The name of the server-side method that will handle this event
is also specified: OnNodeEdit
Please, ask any questions support@obout.com. See How-To page
|