什么是回发数据和视图状态数据之间的差数据、视图、状态

2023-09-03 16:33:29 作者:漓江塔塔主

我想了解一个Asp.net页面生命周期中不同的事件。我碰到这个链接。它有两个阶段,加载视图状态,并加载回发数据。我曾经认为这些既意味着同样的事情。但是,这篇文章说,这回发数据不是视图状态数据。我不明白这一点。如果任何人都可以去看看。

I am trying to understand different events in a Asp.net page life cycle. I came across to this link. It has two stages Load view state and Load postback data. I used to thought that these both means the same thing. But this article says, that postback data is not viewstate data. I don't understand this. If anyone can have a look.

推荐答案

ViewState中的数据是,ASP.NET连接codeD端发送到客户端数据的 _ViewState 隐藏字段。它基本上是页面,因为它是当它被发送到客户端。

ViewState data is data that ASP.NET encoded end sent to the client in the _ViewState hidden field. It's basically the page as it was when it was sent to the client.

回发数据是在用户提交的内容

PostBack data is data that the user submits.

例如,假设你有一个有像这样定义的页面上的文本框:

For example suppose you have a have a textbox on a page defined like so:

<asp:TextBox id="TextBox1" runat="server" text="Some Text" />

您键入的我的用户输入的成文本并提交表单。 某些文本将ViewState的数据和我的用户输入将回传数据。

You type in My user input into the textbox and submit the form. Some Text would be ViewState data and My user input would be the PostBack data.

修改,然后你会在情况下,想了解更多关于ViewState的,还有这里的优秀文章:Truly了解视图状态。

EDIT And in case you would like to learn more about ViewState, there's an excellent article here: Truly Understanding Viewstate.