In order to add a new node or link to a diagram, create an instance of the item class by using the new operator and add it to the diagram's Nodes or Links collection. This works the same way for adding both items from your custom class or ones from the predefined types.
There are several shortcut methods provided for creating instances of the predefined node and link types. The methods are members of the diagram's Factory object:
Users can draw diagram elements with the mouse when ClientSideMode is set to Canvas or when using InteractivityExtender in ImageMap mode. The Behavior property specifies what type of elements should be created when a user starts drawing.
Drawing items in Canvas mode:
When a user starts drawing, an item is created and an initialization event is raised to let you customize the item appearance before showing it on the screen. The initialization events include initializeNode, and initializeLink. While items are being drawn, the control raises validation events such as nodeCreating to let you validate the operation and prevent creating items at a specific location. When the user releases the mouse button, the item is added to the collection that contains items from the same type (for example nodes) and an event is raised, for example nodeCreated.
Drawing items in ImageMap mode:
When the user draws a new item or modifies an existing one, the mouse coordinates are sent to the server, the diagram image is rendered according to the changes made, and sent back to the browser. Some of the following events are raised on the server side: NodeCreated, NodeModified, LinkCreated, LinkModified.
Call the Remove method of the Nodes or Links collection to delete an item from the diagram. The ClearAll method clears diagram contents by deleting all items. To break the relation (delete the link) between two tables, call the BreakRelation method.