因需要编制工作流审批,审批页使用嵌套在iframe中kingeditor,工作流页面代码是通过cs生成的
代码如下:
workfrow 的生成的iframe的CS代码:strValue 方便刷新后设置KindEditor的内容
string text6 = "100%";
string text7 = "300px";
Label label6 = new Label();
label6.Text = "<iframe id='IframeKingEditor' src='kindeditor/KindEditorIndex.aspx?KindEditorValue=" + strValue + "&' frameBorder='0' width='" + text6 + "' scrolling='yes' height='" + text7 + "'></iframe>";
cell.Controls.Add(label6);
break;
刷新前执行 this.Page.RegisterClientScriptBlock("XX", "<script>javascript:getkingEditorValue();</script>");
workfrow的页面读取代码: 通过
function getkingEditorValue()
{
var obj=window.frames["IframeKingEditor"];
alert(obj); //取到的都是null
}
kingeditor页面代码:
head>
<meta charset="utf-8" />
<title>KindEditor ASP.NET</title>
<link rel="stylesheet" href="themes/default/default.css" />
<link rel="stylesheet" href="plugins/code/prettify.css" />
<script charset="utf-8" src="kindeditor.js"></script>
<script charset="utf-8" src="lang/zh_CN.js"></script>
<script charset="utf-8" src="plugins/code/prettify.js"></script>
<script>
KindEditor.ready(function(K)
{
var editor1 = K.create('#KindEditorContent',{
cssPath : '../plugins/code/prettify.css',
uploadJson : '../asp.net/upload_json.ashx',
fileManagerJson : '../asp.net/file_manager_json.ashx',
items : [
'undo', 'redo', '|', 'cut', 'copy', 'paste',
'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright',
'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript',
'superscript', 'quickformat', 'selectall', '|','table', 'hr', , 'map', 'pagebreak', 'link', 'unlink', '|', 'about', '/',
'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold',
'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat'
],
afterCreate :
function()
{
var self = this;
K.ctrl(document, 13,function(){self.sync();K('form[name=example]')[0].submit();});
K.ctrl(self.edit.doc, 13, function() {self.sync();K('form[name=example]')[0].submit();});
}
});
editor1.fullscreen(true);
editor1.html(document.getElementById("KindEditorHtml").value);//设置刷新后的值
prettyPrint();
});
</script>
</head>
<body>
<input type="hidden" name="KindEditorHtml" runat="server" id="KindEditorHtml"/>
<form id="example" runat="server">
<textarea id="KindEditorContent" cols="100" rows="8" style="width:700px;height:300px;visibility:hidden;" runat="server"></textarea>
</form>
</body>
</html>
kingeditorCS代码:
this.KindEditorHtml.Value = Page.Request.QueryString["KindEditorValue"].ToString();
请问如何解决。