c# - When exactly do Page.RegisterAsyncTask's get called? -


i running confusing behavior related async code registered on asp.net page registerasynctask, viewstate, , checkboxes, , need know when these async-tasks run relative when viewstate saved.

i have few checkboxes inside asp:placeholder control. reading record , populating checkboxes, make placeholder visible.

if synchronous - maybe within page_load - well.

if registered async task following happens:

  1. the checkboxes populated.
  2. the placeholder visible.
  3. on postback, checkboxes cannot unchecked. is, if checked retain checked status if user unchecked them. seems checkboxes revert initial values. if checkbox checked on client, makes it! unchecking doesn't.

this doesn't seem problem textboxes. haven't tried other widgets.

i can 'correct' problem setting placeholder visible before register async task. think similar other question grid visiblity:

asp:datagrid visibility async?

it's turning out difficult , resulting in confusing code try pull visiblity-rules out of async methods.

i see asp.net page lifecycle gets saved sometime before onprerender. think registerasynctask'd code gets run same time. order happen in? if viewstate saved before code runs i'm sunk!

edit: found more detail still confusing: halfway down page: http://www.asp.net/web-forms/overview/performance-and-caching/using-asynchronous-methods-in-aspnet-45 says

"methods hooked registerasynctask run after prerender."

this page: https://msdn.microsoft.com/en-us/library/ms178472(v=vs.85).aspx details prerender , savestatecomplete events doesn't mention registerasynctask. need experiment see if shoe-horned between them.

the executeregisteredasynctasks gives more control in when tasks being started.

the executeregisteredasynctasks method automatically called @ point in page processing when registered asynchronous tasks, if exist, invoked non-asynchronous page. this automatic call executeregisteredasynctasks occurs before prerendercomplete event.

from prerendercomplete documentation:

this last event raised before page's view state saved.


Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -