Re: *Very Urgent* dropdownlist in Cute Editor toolbar populated from a database

  •  06-27-2006, 8:57 AM

    Re: *Very Urgent* dropdownlist in Cute Editor toolbar populated from a database

    So I got  a dropdowlist populated using a database:
     
     

    Dim container As System.Web.UI.Control

    container = Editor1.ToolControls("custom").Control

    Dim dropdown As CuteEditor.RichDropDownList

    dropdown = New CuteEditor.RichDropDownList(Editor1)

    'set the onchange statement

    'use the CuteEditor_DropDownCommand => editor.ExecCommand('InsertLink',false,ddl.value)

    ' dropdown.Attributes("onchange") = "CuteEditor_DropDownCommand(this,'InsertLink')"

    'must set this css name

    dropdown.CssClass = "~/styles/screen.css"

    'add the first item (caption)

    'the culture-text would be auto replaced..

    dropdown.Items.Add("[[Template]]", "")

    'hide the first item (caption) in the float-panel

    dropdown.RichHideFirstItem = True

    'add the items here every times

    'add - !!!

    'if the statements put before Controls.Add , the statements must be executed every time

    container.Controls.Add(dropdown)

    'if the statements put after Controls.Add the statements could be executed only the first time

    Dim objRdr As SqlClient.SqlDataReader = Nothing

    objRdr = SiteDB.SiteGetTemplatesByPage(PageID, NewPage)

    If Not Page.IsPostBack Then

    Try

    While objRdr.Read

    dropdown.Items.Add(objRdr("Name"), objRdr("TemplateID"))

    End While

    Finally

    objRdr.Close()

    End Try

    End If

View Complete Thread