Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is the difference between postback data and view state data

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.

like image 989
Vaibhav Jain Avatar asked Apr 21 '10 13:04

Vaibhav Jain


2 Answers

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 textbox on a page defined like so:

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

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.

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

like image 79
Roman Avatar answered Sep 20 '22 03:09

Roman


The viewstate was the current state when the page was rendered to the browser.

The post back data is what the user changed and resubmitted.

like image 41
kemiller2002 Avatar answered Sep 22 '22 03:09

kemiller2002