CuteEditor for .NET

Links Treeview Customization

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:


 

<treedropdowns >

     <LinkTree>

           <item text="Msdn.microsoft.com" Selectable="False">

                 <html><![CDATA[Msdn.microsoft.com <img border=0 align='absMiddle' src='http://cutesoft.net/data/msdn16.gif' />]]></html>

                 <item text=".NET Framework" value="http://msdn.microsoft.com/netframework/">

                       <html><![CDATA[.NET Framework]]></html>

                 </item>

                <item text="ASP.NET Home" value="http://msdn.microsoft.com/asp.net/">

                     <html><![CDATA[ASP.NET Home]]></html>

                </item>

           </item>

           <item text="Yahoo.com" Selectable="False">

                 <html><![CDATA[Yahoo.com <img border=0 align='absMiddle' src='http://cutesoft.net/data/yahoo.gif' /> ]]></html>

                 <item text="Yahoo Web" value="http://www.yahoo.com/">

                       <html><![CDATA[Yahoo Web ]]></html>

                 </item>

            </item>

            <item text="CuteSoft Products" Selectable="False">

                 <html><![CDATA[CuteSoft Products <img border=0 align='absMiddle' src='http://cutesoft.net/data/cutesoft.gif' /> ]]></html>

                 <item text="Cute Chat" value="http://cutesoft.net/ASP.NET+Chat/default.aspx">

                      <html><![CDATA[Cute Chat]]></html>

                 </item>

           </item>

     </LinkTree>

</treedropdowns>
 

Now the Links treeview contains the following links.




 

 


2: Programmatically populate the Links treeview:

C# Example:

if (!IsPostBack) { 
CuteEditor.ToolControl toolctrl=Editor1.ToolControls["LinkTree"];
if(toolctrl!=null) {
CuteEditor.TreeDropDownList tdd=(CuteEditor.TreeDropDownList)toolctrl.Control;
//clear the items from configuration files
tdd.Items.Clear();
CuteEditor.TreeListItem rootitem=new CuteEditor.TreeListItem("Root",null);
rootitem.Selectable=false;
tdd.Items.Add(rootitem);
rootitem.Items.Add("Asp.Net","Asp.Net","http://asp.net");
rootitem.Items.Add("DotNetNuke.Net","DotNetNuke.Net","http://DotNetNuke.com");
rootitem.Items.Add("CuteSoft","CuteSoft","http://CuteSoft.net");



}
}


VB Example:

If Not Page.IsPostBack Then
  If Not Editor1.ToolControls("LinkTree") Is Nothing Then

      Dim tdd As CuteEditor.TreeDropDownList
      Dim richitem As CuteEditor.RichListItem

      tdd = DirectCast(Editor1.ToolControls("LinkTree").Control, CuteEditor.TreeDropDownList)

'clear the items from configuration files
'see Configuration/Shared/Common.config
tdd.Items.Clear()

'Add items by code

Dim rootitem As CuteEditor.TreeListItem
rootitem=new CuteEditor.TreeListItem("Root")

rootitem.Selectable=false
tdd.Items.Add(rootitem)

rootitem.Items.Add("Asp.Net","Asp.Net","http:'asp.net")

rootitem.Items.Add("DotNetNuke.Net","DotNetNuke.Net","http:'DotNetNuke.com")
rootitem.Items.Add("CuteSoft","CuteSoft","http:'CuteSoft.net")

  End If
End If