ASP.Net Lifecycle and Management and View State

In msdn, as they mentioned, view state values ​​are loaded between page_init and page_initcomplete. It suggests that during the request for receiving I assign a value to the text property of the text field, as get with in page_load () { if(!IsPostBack) {textobx.text="get";}}. Thus, this value is stored in the viewstate and visible in the browser. And during my next postback, I assign a post value to the same text property in the event page_init. Since in msdn after the event, page_initcompletethis post value must be overridden by the get value. But this does not happen. Why?

   protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            TextBox1.Text = "hello";
        }
        TextBox2.Text = TextBox1.Text.ToString();

    }
    protected override void OnPreInit(EventArgs e)
    {
            base.OnPreInit(e);
            TextBox1.Text = "init";
    }
    protected override void OnInitComplete(EventArgs e)
    {
            base.OnInitComplete(e);
            TextBox1.Text = "init";

    }

Textbox2.Text, . post back init Textbox2.Text. . ?

+3
3

ViewState. ASP.NET, ViewState InitComplete.

, , Init InitComplete ( btw ), ViewState InitComplete Load.

, , .

+1

.
"" , POSTback . . Load, Init. :
init, Text Init.
, ( "" ).
, text reset "Hello" ( - ).

0

From http://msdn.microsoft.com/en-us/library/ms178472%28v=vs.90%29.aspx :

PreInit:-If the request is a postback, the values ​​of the controls are not yet restored from the view state. If you set a control property at this point, its value may be overwritten in the next event.

Viewstate loads in OnPreLoad

0
source

All Articles