一个文本编辑器,在需要编辑文本的地方,直接插入下面的代码,就能引用。 
<iframe ID="eWebEditor1" src="ewebeditor.htm?id=content1&style=coolblue" frameborder="0" scrolling="no" width="500" HEIGHT="350"> </iframe> 
在.cs中取其处理过的html:
 string content = Convert.ToString(this.eWebEditor1.contentWindow.document.body.innerHTML);
提示错误是:eWebEditor1没有定义。
有于eWebEditor1不是一个导入控件,那如何定义eWebEditor1呢?
取值的代码有问题吗?恳请指点。

解决方案 »

  1.   

    cs只能取runat=server的你可以在提交数据前,把eWebEditor1的值付给一个runat=server的控件,比如hidden之类的,然后cs取就可以了 ^^
      

  2.   

    如何写代码,把iframe的值赋给this.HiddenField1.Value?
      

  3.   

    用js 写HiddenField1.Value = this.eWebEditor1.contentWindow.document.body.innerHTML
      

  4.   

    <asp:HiddenField runat="server" id="hdnValue" />code in iframe:
    document.getElementById("hdnValue").value = "your value";
    //if this code doesn't work, try this
    parent.document.getElementById("hdnValue").value="your value";
      

  5.   

    iframe 加个runat="server"
    试试