简体   繁体   中英

question about asp.net lifecycle

how can i programmatically restart page lifecycle? i do some stuff in controls events which affects these controls. to see changes i have to draw page again. how can i do it?

The page will be "re-drawn" near the end of the page lifecycle, during the Render phase. Remember that immediately after this happens, this instance of your page is destroyed. That is the nature of the web. The page lifecycle will re-start when the user triggers a postback in their browser. At this point, a brand new instance of your page class is created. This new instance will strongly resemble the previous instance, but it's still a completely different instance of the class. This is how ASP.Net works.

You can do something like this:

Response.Redirect(HttpContext.Current.Request.Url.AbsolutePath);

but you may lose your drawing if you don't save it somewhere on server or client (eg cookie)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM