javascript - How can I defer loading UpdatePanel content until after the page renders? -
old hand @ asp.net, new updatepanel. have reporting page executes length sql query... takes 10 seconds right now. have page render, placeholder text (loading...) , have updatepanel kick off actual time-consuming reporting process , render report when it's done.
so... theory use registerstartupscript() kick off , drop string getpostbackeventreference() trigger updatepanel update. problems crop up:
1) can use getpostbackeventreference w/ updatepanel or need trigger other way? use method on button inside update panel?
2) event gets triggered when postback reference updatepanel? it's not clear me. i've got call databinding code somewhere! again, maybe need use button inside?
i had similar recently, here's how did (right or wrong):
the trick "hidden async postback trigger".
<asp:updatepanel id="upfacebookimage" runat="server"> <contenttemplate> <!-- updatepanel content --> </contenttemplate> <triggers> <asp:asyncpostbacktrigger controlid="hiddenasynctrigger" eventname="click" /> </triggers> </asp:updatepanel> <asp:button id="hiddenasynctrigger" runat="server" text="asyncupdate" style="display:none;" />
then javascript, whenever want trigger async postback, this:
__dopostback('<%= hiddenasynctrigger.clientid %>', 'onclick');
in example, needed trigger async postback particular js event. attach doc ready.
i seem remember trying @marko ivanovski's way, reason didn't work. think need specify "postback-able" control (ie button) trigger postback.
hth.
Comments
Post a Comment