<form>
<asp:button id="btnRead" runat="server" Text="阅读日记"></asp:button>
<asp:button id="btnAdd" runat="server" Text="写日记"></asp:button>
</form>
<iframe id="iframe1" marginWidth="0" hspace="0" vspace="0" marginHeight="0" frameBorder="0"width="618" height="230"></iframe>
这是index.aspx页面的
我想在btnRead的click事件里编程,让新的页面read.aspx在iframe1中显示,各位帮一下

解决方案 »

  1.   

    这个起码写了5遍喽。
    <iframe runat="server" id="iframe1" .....><iframe>然后在代码的class域首先声明:protected HtmlGenericControl iframe1;然后在事件中写:iframe1.Attribute.Item["src"]="read.aspx";
      

  2.   

    Attribute应该是Attributes吧,可Attributes里没有Item啊
      

  3.   

    iframe1.Attributes.Add("src","read.aspx");我这样写 通过了
    我要传值的话,直接就read.aspx?date=....就行了吧
      

  4.   

    是 Attributes!!一定有Item。应该也可以写 iframe1.Attribute["src"],或者使用 iframe1.Attribute.Add("src",...)。
      

  5.   

    Sorry! 又少s了。传值,通常可以写成:iframe1.Attributes.Add("src",String.Format("read.aspx?a={0}&b={1}",
      P1.ToString(),P2.ToString()));
      

  6.   

    是 Attributes!!一定有Item。应该也可以写 iframe1.Attribute["src"],或者使用 iframe1.Attribute.Add("src",...)。来去都是缘 没有Item 我在vs2003中写iframe1.Attributes在打点,里面没有Item,要不你进去看看