Re: How to add dynamically from code behind a Link list in dropDownList

  •  11-26-2013, 6:38 AM

    Re: How to add dynamically from code behind a Link list in dropDownList

    Hi Raney,

     

    Please try the way below to add the links dynamically. More details please refer to http://cutesoft.net/developer+guide/scr/Links_dropdown_Customization.htm 

     

    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  

     

    Regards,

     

    Ken 

View Complete Thread