Here is a simple way to use iframe in  In responding to a Chinese forum question, I write the following code to direct a new page to the iframe when clicking a button.


Here’s the sample code I write with VS2008.


<%@ Page Language="C#" %>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">


<script type="text/javascript">

   function Buton1ClientClick()






<script runat="server">


   protected void Button1_Click(object sender, EventArgs e)







<html xmlns="">

<head id="Head1" runat="server">

    <title>Untitled Page</title>



    <form id="form1" runat="server">


       <asp:ScriptManager ID="ScriptManager1" runat="server">


       <asp:UpdatePanel ID="UpdatePanel1" runat="server">


             <asp:Button ID="Button1" runat="server" Text="Button"

          OnClientClick="Buton1ClientClick();" />





    <form id="form2" action="webForm2.aspx" target="test">



       <iframe name="test" src="webForm1.aspx"></iframe>







This code only demonstrated one of the simple ways to handle <iframe> post in a button.  I don’t personally recommend this way.  I recommend using of AJAX directly without <iframe>, or use .




这是在asp.net中一个使用iframe的简单方式。我在回答一个中文asp.net论坛问题时,写了上面的简单页面,点击按钮来改变iframe里的页面显示。页面在VS2008中生成。 这段程序只是显示了一个简单的方式,我个人并不推荐使用。我推荐直接使用AJAX,或者使用 .