<iframe id="iframe1" runat="server"></iframe>后台代码:protected HtmlContainerControl iframe1;iframe1.Attributes["width"] = width;
iframe1.Attributes["height"] = height;

解决方案 »

  1.   

    以下代码经过测试
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="gb2312" lang="gb2312">
    <head>
    <title> New Document </title>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <meta name="title" content="" />
    <meta name="author" content="活靶子,Huobazi,www.AspxBoy.com" />
    <meta name="subject" content="" />
    <meta name="language" content="gb2312" />
    <meta name="keywords" content="" />
    <meta name="Copyright" content="www.AspxBoy.com" />
    <meta name="robots" content="all" />
    <script>
    function aaa(size)
    {
    document.all.frm.width=size;
    }</script>
    </head>
    <body>
    <table border="0"><tr>
    <td>
    <input type=button onclick="aaa(500)" value="width500px">
    <br />
    <input type=button onclick="aaa(200)" value="width200px">
    </td>
    </tr>
    <tr>
    <td>
    <iframe id="frm" name="frm" src=http://www.aspxboy.com />
    </td>
    </tr>
    <table>
    </body>
    </html>
      

  2.   

    不行啊。刚试的。说实例不存在。下面是代码片断:
    在绑定.cs中:
    protected HtmlContainerControl ifFirstPage;
    ifFirstPage.Attributes["width"] = "100";
    ifFirstPage.Attributes["height"] = "100";
    在.aspx中:<myNS:PageView>
    <iframe id="ifFirstPage"  src="/WebPlan/Source/FirstPage.aspx" width="100%" height="100%" scrolling="yes" frameborder="1"></iframe>
    </myNS:PageView>
      

  3.   

    try
    iframe id="ifFirstPage"  src="/WebPlan/Source/FirstPage.aspx" width="100%" height="100%" scrolling="yes" frameborder="1"></iframe>
    ----->
    protectedHtmlGenericControl  ifFirstPage
    iframe id="ifFirstPage"  src="/WebPlan/Source/FirstPage.aspx" width="100%" height="100%" scrolling="yes" frameborder="1" runat=server></iframe>