Get the App
SLTechnology News&Howtos  ›  Development  › 

How to analyze the Web Page life cycle of ASP.NET Postback

Shulou Source: shulou.com Published: 2022-06-02 10:02:43 09月15日 Update

This article introduces you how to analyze the Web Page life cycle of ASP.NET Postback, the content is very detailed, interested friends can refer to, hope to be helpful to you.

When it comes to ASP.NET Postback, you have to say the Web Page life cycle, but the Web Page life cycle can not be clearly said in a few words, so from the point of view of programming, put aside the Web Page life cycle and talk about Postback.

We know that both ASP.NET1.x,2.0 and later versions of ASP.NET end up browsing through the browser from Render to client: a simple HTML. Client submits the data filled in Form to Server for processing by Submit Form. Let's now look at the process of the ASP.NET Postback program.

First, let's look at a Sample to see how ASP.NET handles a Postback generated by Click and a Button. Here is the HTML of Web Page:

TestPage

Quite simply, three Button are defined and their two Event:Click and Command are registered. The Command Event Hander of the three Button is the same: Button_Command, which uses the specified CommandArgument to let the Event Handler determine which Button triggered the Command Event.

Here is the Code Behind:

UsingSystem

UsingSystem.Data

UsingSystem.Configuration

UsingSystem.Web

UsingSystem.Web.Security

UsingSystem.Web.UI

UsingSystem.Web.UI.WebControls

UsingSystem.Web.UI.WebControls.WebParts

UsingSystem.Web.UI.HtmlControls

Publicpartialclass_Default:System.Web.UI.Page

{

ProtectedvoidPage_Load (objectsender,EventArgse)

{

}

ProtectedvoidButton1_Click (objectsender,EventArgse)

{

Stringstringmessage=string.Format ("The {0} eventof {1} isfired", "Click", "Button1")

This.LabelMessage.Text=message

}

ProtectedvoidButton2_Click (objectsender,EventArgse)

{

Stringstringmessage=string.Format ("The {0} eventof {1} isfired", "Click", "Button2")

This.LabelMessage.Text=message

}

ProtectedvoidButton3_Click (objectsender,EventArgse)

{

Stringstringmessage=string.Format ("The {0} eventof {1} isfired", "Click", "Button3")

This.LabelMessage.Text=message

}

ProtectedvoidButton_Command (objectsender,CommandEventArgse)

{

Stringstringmessage=string.Format ("The {0} eventof {1} isfired"

"Command", e.CommandArgument)

This.LabelMessage.Text+= ";" + message

}

}

On how to analyze the Web Page life cycle of ASP.NET Postback to share here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Tags: Cycle life analysis content more processing help browsing yes clear a few words two interests guys buddies data articles ways browsers versions Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info MySQL Shulou Technology vpn NVidia