CuteEditor for .NET

Links Treeview Customization

The Links Treeview of CuteEditor by default displays a predefined set of Links. You can easily modify this default set using the following methods:

1. Edit treeview Configuration file (Common.config):

The treeview configuration file (Common.config) can be found in the /CuteEditor/Configuration/Shared folder. In treeview configuration file you can find the Links element which contains the configuration information for the Links treeview within CuteEditor.

You can modify the Links element to create your own Links list.

Example:

  1. <treedropdowns>  
  2.    <LinkTree>  
  3.       <item text="Msdn.microsoft.com" Selectable="False">  
  4.          <html><![CDATA[Msdn.microsoft.com <img border='0' src='http://cutesoft.net/data/msdn16.gif' />]]></html>  
  5.          <item text=".NET Framework" value="http://msdn.microsoft.com/netframework/">  
  6.             <html><![CDATA[.NET Framework]]></html>  
  7.          </item>  
  8.          <item text="ASP.NET Home" value="http://msdn.microsoft.com/asp.net/">  
  9.             <html><![CDATA[ASP.NET Home]]></html>  
  10.         </item>  
  11.       </item>  
  12.       <item text="Yahoo.com" Selectable="False">  
  13.          <html><![CDATA[Yahoo.com <img border='0' src='http://cutesoft.net/data/yahoo.gif' /> ]]></html>  
  14.          <item text="Yahoo Web" value="http://www.yahoo.com/">  
  15.             <html><![CDATA[Yahoo Web ]]></html>  
  16.          </item>  
  17.       </item>  
  18.       <item text="CuteSoft Products" Selectable="False">  
  19.          <html><![CDATA[CuteSoft Products <img border='0' src='http://cutesoft.net/data/cutesoft.gif' /> ]]></html>  
  20.          <item text="Cute Chat" value="http://cutesoft.net/ASP.NET+Chat/default.aspx">  
  21.             <html><![CDATA[Cute Chat]]></html>  
  22.          </item>  
  23.       </item>  
  24.   </LinkTree>  
  25. </treedropdowns>  

Now the Links treeview contains the following links.



2. Programmatically populate the Links treeview:

C# Example:

  1. if (!IsPostBack) {    
  2.    CuteEditor.ToolControl toolctrl=Editor1.ToolControls["LinkTree"];    
  3.    if(toolctrl!=null) {    
  4.       CuteEditor.TreeDropDownList tdd=(CuteEditor.TreeDropDownList)toolctrl.Control;    
  5.       //clear the items from configuration files    
  6.       tdd.Items.Clear();    
  7.       CuteEditor.TreeListItem rootitem=new CuteEditor.TreeListItem("Root",null);   
  8.       rootitem.Selectable=false;    
  9.       tdd.Items.Add(rootitem);    
  10.       rootitem.Items.Add("Asp.Net","Asp.Net","http://asp.net");    
  11.       rootitem.Items.Add("DotNetNuke.Net","DotNetNuke.Net","http://DotNetNuke.com");    
  12.       rootitem.Items.Add("CuteSoft","CuteSoft","http://CuteSoft.net");          
  13.    }    
  14. }  

VB Example:


  1. If Not Page.IsPostBack Then  
  2.   If Not Editor1.ToolControls("LinkTree"Is Nothing Then  
  3.       Dim tdd As CuteEditor.TreeDropDownList   
  4.       Dim richitem As CuteEditor.RichListItem   
  5.       tdd = DirectCast(Editor1.ToolControls("LinkTree").Control, CuteEditor.TreeDropDownList)   
  6.       'clear the items from configuration files    
  7.       'see Configuration/Shared/Common.config    
  8.       tdd.Items.Clear()    
  9.       'Add items by code    
  10.       Dim rootitem As CuteEditor.TreeListItem    
  11.       rootitem=new CuteEditor.TreeListItem("Root")    
  12.       rootitem.Selectable=false    
  13.       tdd.Items.Add(rootitem)    
  14.       rootitem.Items.Add("Asp.Net","Asp.Net","http:'asp.net")    
  15.       rootitem.Items.Add("DotNetNuke.Net","DotNetNuke.Net","http:'DotNetNuke.com")    
  16.       rootitem.Items.Add("CuteSoft","CuteSoft","http:'CuteSoft.net")   
  17.   End If  
  18. End If