none
ASP.NET Web Forms FAQ: Bagaimana menggunakan Server.Transfer? RRS feed

  • Diskusi Umum

  • Page1.aspx

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

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

    <script runat="server"> 

        protected void Button_Click(object sender, EventArgs e) 

        { 

            Server.Transfer("page2.aspx", true); 

     

        } 

    </script> 

    <html xmlns="http://www.w3.org/1999/xhtml"> 

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

    </head> 

    <body> 

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

        <div> 

            <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button_Click" /> 

            <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> 

        </div> 

        </form> 

    </body> 

    </html>

     

    Page2.aspx

     

    <%@ Page Language="C#" %> 
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    <script runat="server"> 
        protected void Page_Load(object sender, EventArgs e) 
        { 
            Response.Write(Request.Form["TextBox1"]); 
        } 
    </script> 
    <html xmlns="http://www.w3.org/1999/xhtml"> 
    <head id="Head1" runat="server"> 
    </head> 
    <body> 
        <form id="form1" runat="server"> 
        <div> 
             
        </div> 
        </form> 
    </body> 
    </html>
     
    Thread terkait:
     
    Jumat, 19 Agustus 2011 06.54
    Moderator