Welcome Guest Search | Active Topics | Sign In | Register

Adding dropdown list dynamically to editor Options
Mark
Posted: Wednesday, November 11, 2009 9:59:00 AM
Rank: Member
Groups: Member

Joined: 3/5/2009
Posts: 19
We're adding mutliple editor controls to dynamically built .aspx pages. Everything works great, however we need the ability to insert text from a drop down that is also dynamically built. As a previous post described, putting the dropdown box outside of the control inserts the the text at the end of the editor. I've search through the sample code and postings here, but I can't seem to find the correct syntax to add a drop down dynamically at run time. Any help would be appreciated. Thanks!

Code: Visual Basic.NET
Dim tbData As New EO.Web.Editor
                    tbData.ToolBarSet = EO.Web.EditorToolBarSet.Custom

                    tbData.ToolBarItems = "FontSizes,,Bold,Italic,Underline,,AlignLeft,AlignCenter,AlignRight,AlignJustify,,BulletList,NumberedList,,SpellCheck"
                    tbData.Height = 220
                    tbData.Width = 520

                    tbData.SpellCheckerID = "SpellChecker1"

                    tbData.EditAreaStyle.CssClass = "editor_body_border"
                    tbData.TextAreaCssFile = "~\editor.css"
                    tbData.HtmlBodyCssClass = "editor_body"
                    tbData.PasteFilter = EO.Web.EditorPasteFilter.MsWordAuto
                    tbData.FooterVisible = False

                    tbData.ID = ("tbData" & i.ToString)

                    tbData.Html = tText

                    tcData.Controls.Add(tbData)
eo_support
Posted: Wednesday, November 11, 2009 11:33:39 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

You won't be able to use ToolBarItems because that only works for pre-defined commands. Instead you will need to use CustomHeaderTemplate to supply an ITemplate object. Inside your ITemplate's InstantiateIn method you can then create all ToolBarItem dynamically. To create a custom drop downbox, you will need to use a custom ToolBarItem. See here for how to use custom toolbar item:

http://demo.essentialobjects.com/Default.aspx?path=ToolBar\_i1\_i2

An easier way is to encapsulate all these inside a user control and then load the user control dynamically. You will need to expose additional properties on the user control so that you will have access to the data (for example, get/set Editor text) or have certain customization abilities (for example, to set the editor's HtmlBodyCssClass property).

Once you have the drop down list, you will need to handle the drop down list's onchange event (JavaScript) to call our client side JavaScript API to insert the text.

Hope this helps.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.