做了一个在线编辑器,有这样的代码
<iframe id="htmlContent" frameborder="0" marginWidth="4" marginHeight="4"></iframe><!--内容区-->把这个编辑器单独放到了一个用户控件里
htmlEdit.ascx又给这个用户控件做了两个属性
#region Properties & Fields
    private string _File;
    private string _Content;
    /// <summary>
    /// 附件
    /// </summary>
    public string oFile
    {
        get { return _File; }
        set { _File = value; }
    }
    /// <summary>
    /// 内容
    /// </summary>
    public string oContent
    {
        get { return _Content; }
        set { _Content = value; }
    }
    #endregion如何将iframe 的innerHTML值赋给它的oContent?对外看来,直接拿控件ID.oContent即可?

解决方案 »

  1.   

    用JavaScript把innerHtml存到一个文本控件中,从后台获取就行了。
      

  2.   

    //用JavaScript把innerHtml存到一个文本控件中,从后台获取就行了。
    javascript在什么时候把innerHtml存到一个文本控件中呢?
    iframe没有onpropertychange方法..
      

  3.   

    如果控件本身没有触发,只能在页面上触发了,脚本写到页面上去,不过这样就破坏了控件的封装了。
    我想还有一个办法,就是使用javascript做一个客户端定时操作,将内容定时存入文本框。
      

  4.   

    将iframe放在form表单里面,用POST或GET方法提交
    然后在C# code里面再做一个属性    public string Value
        {
            get { return _Value; }
            set { _Content = Request.Form["htmlContent"]; }
        }再将Value给oContent就行了.......没测试过,你自己试下
      

  5.   

    这样说吧,怎样用C#取出iframe里的innerHtml?
      

  6.   

    使用msHtml的命名空间,可以以类似Html的方式访问Document对象,具体可以参考MSDN
      

  7.   

    以上思路都不正确,正确答案:
    http://blog.tiantiansoft.com/user1/9/archives/2006/2963.html