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

ASP.NET, what is the process of the whole Postback program?

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

Share

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

It is believed that many inexperienced people are at a loss about the process of ASP.NET 's entire Postback program. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

ASP.NET the process of processing the entire Postback program

We know that whether it's ASP.NET1.x, 2. 0, or even later, ASP.NET ends 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. Now let's take a look at the entire Postback process of ASP.NET.

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:

Test Page

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:

Using System

Using System.Data

Using System.Configuration

Using System.Web

Using System.Web.Security

Using System.Web.UI

Using System.Web.UI.WebControls

Using System.Web.UI.WebControls.WebParts

Using System.Web.UI.HtmlControls

Public partial class _ Default: System.Web.UI.Page

{

Protected void Page_Load (object sender, EventArgs e)

{

}

Protected void Button1_Click (object sender, EventArgs e)

{

String message = string.Format ("The {0} event of {1} is fired", "Click", "Button1")

This.LabelMessage.Text = message

}

Protected void Button2_Click (object sender, EventArgs e)

{

String message = string.Format ("The {0} event of {1} is fired", "Click", "Button2")

This.LabelMessage.Text = message

}

Protected void Button3_Click (object sender, EventArgs e)

{

String message = string.Format ("The {0} event of {1} is fired", "Click", "Button3")

This.LabelMessage.Text = message

}

Protected void Button_Command (object sender, CommandEventArgs e)

{

String message = string.Format ("The {0} event of {1} is fired"

"Command", e.CommandArgument)

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

}

}

After reading the above, have you mastered the process of the whole Postback program of ASP.NET? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

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