通过代码动态的添加编辑器:

① 如果你使用的应用程序的方法(虚拟目录),你需要在web.config中设置BasePath

For example if this is your FCKeditor path "c:/inetpub/wwwroot/virtualdir/FCKeditor/" add this:

<add key="FCKeditor:BasePath" value="~/FCKeditor/" />

 

② 使用Session来设置文件浏览的路径,在控制之前添加session变量(当需要动态目录时这将非常有用)

 Session("FCKeditor:UserFilesPath") = "/virtualdir/userfiles/"

 

③ 为了建立正确的BasePath,通过使用请求对象实现。这里我假设正确的路径为http://<host>/FCKEditor/

 FCKeditor1.BasePath = Request.ApplicationPath + "/FCKEditor/";

 

④ 在页面上添加如下的控制语句:

Dim fckeditor As New FredCK.FCKeditorV2.FCKeditor

fckeditor.ImageBrowserURL = "http://localhost/virtualdir/FCKeditor/editor/filemanager/browser/default/browser.html?Type=Image&Connector=connectors/aspx/connector.aspx"

fckeditor.ID = "dynamicname"

fckeditor.Value = "the text you want in the FCK editor"

fckeditor.SkinPath = "skins/silver/"

fckeditor.ToolbarSet = "Default"

myForm.Controls.Add(fckeditor)

 

posted on 2008-10-05 11:08  长河落日  阅读(156)  评论(0)    收藏  举报