<%@ 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"> 
    public String UserName
    {
        get { 
return this.txtName.Text; }
    }
    protected 
void Button1_Click(object sender, EventArgs e)
    {
        Label1.Text 
= "Postback from self. Your Name is:" + txtName.Text;
    } 
</script>

<html xmlns="http://www.w3.org/1999/xHTML">
<head runat="server">
    
<meta content="text/JScript" http-equiv="content-script-type" />
    
<title>First Page</title>
</head>
<body>
    
<form id="form1" runat="server">
        
<div>
            
<h3>
                The Frist Page
</h3>
            Your Name:
            
<asp:TextBox ID="txtName" runat="server" />
            
<asp:Label ID="Label1" runat="server" EnableViewState="False" /><br />
            
<br />
            
<asp:Button ID="Button1" runat="server" Text="Postback to Same Page"
                     OnClick
="Button1_Click" /><br />
            
<br />
            
<asp:Button ID="Button2" runat="server" Text="Postback to Second Page"
                     PostBackUrl
="Prev_SecondPage.aspx" /><br />
        
</div>
    
</form>
</body>
</html>

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-05
猜你喜欢
  • 2021-12-27
  • 2022-12-23
  • 2021-09-22
  • 2021-09-21
  • 2022-01-19
  • 2022-02-15
  • 2022-01-19
相关资源
相似解决方案