在cshtml中显示FCKeditor编辑器控件
生活随笔
收集整理的這篇文章主要介紹了
在cshtml中显示FCKeditor编辑器控件
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
?
步驟:1.????導(dǎo)入文件夾fckeditor
2.????導(dǎo)入dll文件(FredCK.FCKeditorV2.dll)
3.????在cshtml中的代碼
@Html.Raw(ViewBag.FckEditor)
4.在Controller中的代碼
????????public?void?FCK()
????????{
????????????FredCK.FCKeditorV2.FCKeditor?editor?=?new?FredCK.FCKeditorV2.FCKeditor();
????????????editor.ID?=?"MyFck";
????????????System.Web.UI.HtmlControls.HtmlForm?hf?=?new?System.Web.UI.HtmlControls.HtmlForm();
????????????hf.Controls.Add(editor);
????????????System.Web.UI.Page?page?=?new?System.Web.UI.Page();
????????????string?controlOutput?=?string.Empty;
????????????page.Controls.Add(hf);
????????????StringBuilder?sb?=?new?StringBuilder();
????????????using?(System.IO.StringWriter?sw?=?new?System.IO.StringWriter(sb))
????????????{
????????????????using?(System.Web.UI.HtmlTextWriter?htw?=?new?System.Web.UI.HtmlTextWriter(sw))
????????????????{
????????????????????Server.Execute(page,?htw,?false);//?調(diào)用這個(gè)方法將page內(nèi)容轉(zhuǎn)化成輸入流
????????????????????controlOutput?=?sb.ToString();//將html輸出流轉(zhuǎn)化為字符串
????????????????}
????????????}
????????????ViewBag.FckEditor?=?controlOutput;
????????}
?
?
轉(zhuǎn)載于:https://www.cnblogs.com/shizhi57/archive/2011/07/01/2095228.html
超強(qiáng)干貨來(lái)襲 云風(fēng)專訪:近40年碼齡,通宵達(dá)旦的技術(shù)人生總結(jié)
以上是生活随笔為你收集整理的在cshtml中显示FCKeditor编辑器控件的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 【遇到问题】ORA-27102 ORA-
- 下一篇: vmware Failed to ini