Documentum Tree Control
| October 2005 | |
Abstract
The Documentum Tree Control extends the standard ASP.NET 2.0 tree control and binds a repository structure to the tree control. It displays folders and cabinets within a repository.
Description
The tree control sits in the toolbox. It can be dragged and placed onto a webform. The root node of the tree control needs to be set to the repository name to which the tree must bind. The root node can be set at design time or programmatically. You may add multiple root nodes, one for each repository. To set it at design time -
- Drag a DocumentumTreeControl onto a webform
- Right-click and select 'Edit Nodes'
- Click 'Add a Root Node' (a + sign in the top-left corner of the window)
- Set the nodes 'Text' and 'Value' properties to the repository name.
- Set the nodes 'PopulateOnDemand' property to 'true' . This is needed so that the node can perform a postback to obtain its children.

Fig - Setting a Root Node
The tree control obtains a repository session from the DmContext instance in the HttpSessionState of the user. You can use the login control to establish a Documentum session. The r_object_id of the folder or cabinet is stored as the 'Value' attribute of the 'TreeNode' class.
As the tree control extends the standard tree control it inherits all the properties of the basic tree control including the event handlers. You can refer to the documentation on the MSDN website for more details about customizing the tree control.
The tree control reuses the icons from WDK. You will need to download and install WDK from the products download page . To reuse these icons, copy the 'icons' folder from WDK_VIRTUAL_ROOT\wdk\theme\documentum to your ASP.NET webapp. Reference this folder in the tree control's property - 'DocumentumIconsFolder'. The path should start with '~/', which implies its relative to the webapp and it should end with a '/'. This property can be set in the Visual Studio designer.

Fig - Icons Path
If you don't have WDK, you will need to create icons for a Repository node, a cabinet and a folder. Create the following 16x16 icons -
- ~/icons/type/t_dm_folder_16.gif
- ~/icons/type/t_dm_cabinet_16.gif
- ~/icons/type/t_docbase_16.gif
Then reference the folder in the property as '~/icons/'
Note:The tree control still works without the icons.
A Simple Repository Browser
The tree control,the DQLDataSource control and the standard GridView can be combined to create a simple document browser. The tree updates the select query in the DQLDataSource based on the node clicked and the GridView points to the DQLDataSource control.

Fig - Simple Browser
- Drag a DQLDataSource control, a DocumentumTreeControl and a GridView onto a webform
- Set the 'DataSource' of the GridView to be the DQLDataSource
- Set the ConnectionString property of the DQLDataSource
- Set the value of the root node of the tree control to the repository name that you want to explorer
- Add the following code to the onclick event of the tree control. To open the event handler, double-click on
the tree control -
.The following code obtains the object id in the onclick event handler of the tree control -
DocumentumTreeControl src = (DocumentumTreeControl)sender;
TreeNode selNode = src.SelectedNode;
string objId = selNode.Value;
RefreshGrid(objId);
|
The RefreshGrid function is here-
private void RefreshGrid(String id)
{
string query = "select r_object_id,object_name from dm_document where FOLDER(ID('" + id + "'))";
DQLDataSource1.SelectQuery = query;
GridView1.DataBind();
}
|
|