[我的ASP.net学习历程]IsPostBack

类别:Asp 点击:0 评论:0 推荐:
<%@ Page Language="C#" AutoEventWireup="True" %>
<Script language="C#" runat="server">
void Page_Load(Object Sender,EventArgs e){
 if (!IsPostBack){  //判断是否为第一次页面调入
  Label_1.Text="Good!";
  }
 else{
  Label_1.Text="Bad";
  }
}
void ButtonClick(Object Sender,EventArgs e){
 Label_2.Text="Button is click!";
 }
</Script>
<asp:label ID="Label_1" runat="server"></asp:label>
<form id="Form_1" runat="server">
 <asp:button ID="Button_1" Text="Button" OnClick="ButtonClick" runat="server"/>
</form>
<asp:label ID="Label_2" runat="server"></asp:label>

本文地址:http://com.8s8s.com/it/it8560.htm