开发者

question about asp.net lifecycle

开发者 https://www.devze.com 2022-12-25 12:08 出处:网络
how can i programmatically restart page lifecycle? i do some stuff in controls events which affects these controls. to see ch开发者_运维技巧anges i have to draw page again. how can i do it?The page wi

how can i programmatically restart page lifecycle? i do some stuff in controls events which affects these controls. to see ch开发者_运维技巧anges 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 (e.g. cookie)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号