ueditor赋值
今天搞了好就終于找到一個解決辦法:分享如下:
我介紹的是從數據庫賦值
后臺代碼:
this.lable1.Text = dr["字段名"].ToString();//對前臺Id為lable的控件賦值
前臺代碼:
<asp:Label ID="editoraa" runat="server" Visible="false" Text=""></asp:Label>
<script type="text/plain" id="editor"><%=this.editoraa.Text%></script>//此處獲取lable控件的值
<script type="text/javascript">
var editor = new baidu.editor.ui.Editor({
UEDITOR_HOME_URL: '',
autoClearinitialContent: false,//點擊編輯框的時候 值不會消失
textarea: 'editorcontent'
});
editor.render('editor');
</script>
如果要取值的話在后臺:string aa= Request.Params["editorcontent"].ToString();
就OK!!!
配置:在editor_config.js文件修改
var tmp = window.location.pathname;
//URL = window.UEDITOR_HOME_URL || tmp.substr(0, tmp.lastIndexOf("\/") + 1).replace("_examples/", "").replace("website/", "");
//這里你可以配置成ueditor目錄在您網站的相對路徑或者絕對路徑(指以http開頭的絕對路徑)URL = "/UEditor/ueditor/";
/**
常見錯誤:從客戶端(editorValue=”<p>歡迎使用ueditor!</p>”)中檢測到有潛在危險的 Request.Form 值。
解決方法:web.config文件
<system.web>
<pages validateRequest="false" theme="Default"/>
<httpRuntime requestValidationMode="2.0" />
</system.web>
本人菜鳥一個, 老鳥們有好的方法 請賜教
總結
- 上一篇: 【百度地图API】如何制作可拖拽的沿道路
- 下一篇: 播放中国少年先锋队队歌歌曲(播放中)