Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

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

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report