Problems with Partial Page rendering on initial page load http://forums.asp.net/t/1252524.aspx/1?Problems+with+Partial+Page+rendering+on+initial+page+load+Wed, 07 May 2008 20:10:41 -040012525242319023http://forums.asp.net/p/1252524/2319023.aspx/1?Problems+with+Partial+Page+rendering+on+initial+page+load+Problems with Partial Page rendering on initial page load <p>&nbsp;1. Checkbox list - Items get selected on page load based on selected values in Session object.<br> 2. Submit button<br> 3. GridView - The parameters for the query come from the selected values in Session object. It is bound to an ObjectDataSource (BL layer). <br> 4. Update Panel - The GridView is inside the UpdatePanel and is triggered on Click event of the Submit button.<br> 5. UpdatePanelAnimationExtender to show 'loading' animation.<br> <br> On Page Load <br> 1. The Checkbox gets populated <br> 2. The GridView query is populated based on the parameters from Session object.<br> <br> On Submit<br> 1. The user checks a couple of more items and hits submit.<br> 2. The Session object gets updated with the new selected values.<br> 3. The GridView query is executed. <br> 4. The UpdatePanel gets triggered on the Submit button click action.<br> 5. The UpdatePanelAnimationExtender triggers the javascript and displays the loading gif.<br> <br> The problem is that I am not able to successfully implement the partial rendering technique on Page Load. The Page Loads completely only after the GridView is loaded. <br> <br> How can I :<br> 1. Load everything except the GridView on initial page load<br> 2. Trigger the GriView load and show the animation.<br> <br> Any help is appreciated.<br> </p> <p>Here's the code snippet for all the aspx object:</p> <p>&nbsp;</p> <p>&nbsp;</p> <pre class="prettyprint">&lt;asp:CheckBoxList ID=&quot;chkClientList&quot; runat=&quot;server&quot; AutoPostBack=&quot;False&quot; DataSourceID=&quot;ObjectDataSource1&quot; DataTextField=&quot;Client_Acct&quot; DataValueField=&quot;Client_Acct&quot; RepeatColumns=&quot;10&quot; RepeatDirection=&quot;Horizontal&quot; OnSelectedIndexChanged=&quot;chkClientList_SelectedIndexChanged&quot; OnDataBound=&quot;chkClientList_DataBound&quot;&gt; &lt;/asp:CheckBoxList&gt; &lt;div style=&quot;overflow:scroll;height:85%;border:1px solid;width:&quot; id=&quot;divGrid&quot;&gt; &lt;asp:UpdatePanel ID=&quot;UpdatePanel1&quot; runat=&quot;server&quot;&gt; &lt;ContentTemplate&gt; &lt;asp:GridView ID=&quot;GridView1&quot; runat=&quot;server&quot; DataSourceID=&quot;ObjectDataSource3&quot; AllowPaging=&quot;True&quot; AllowSorting=&quot;True&quot; SkinID=&quot;gridView&quot;&gt; &lt;/asp:GridView&gt; &lt;/ContentTemplate&gt; &lt;Triggers&gt; &lt;asp:AsyncPostBackTrigger ControlID=&quot;btnSearch&quot; EventName=&quot;Click&quot; /&gt; &lt;/Triggers&gt; &lt;/asp:UpdatePanel&gt; &lt;/div&gt; &lt;asp:ObjectDataSource ID=&quot;ObjectDataSource3&quot; runat=&quot;server&quot; SelectMethod=&quot;GetData&quot; TypeName=&quot;DataBL&quot;&gt; &lt;SelectParameters&gt; &lt;asp:SessionParameter Name=&quot;sessionData&quot; SessionField=&quot;SESSION_SESSIONDATA&quot; Type=&quot;Object&quot; /&gt; &lt;/SelectParameters&gt; &lt;/asp:ObjectDataSource&gt; &lt;cc1:UpdatePanelAnimationExtender ID=&quot;upae&quot; BehaviorID=&quot;animation&quot; runat=&quot;server&quot; TargetControlID=&quot;updatePanel1&quot;&gt; &lt;Animations&gt; &lt;OnUpdating&gt; &lt;Parallel duration=&quot;0&quot;&gt; &lt;%-- place the update progress div over the gridview control --%&gt; &lt;ScriptAction Script=&quot;onUpdating();&quot; /&gt; &lt;FadeOut MinimumOpacity=&quot;.5&quot; /&gt; &lt;/Parallel&gt; &lt;/OnUpdating&gt; &lt;OnUpdated&gt; &lt;Parallel duration=&quot;0&quot;&gt; &lt;%--find the update progress div and place it over the gridview control--%&gt; &lt;ScriptAction Script=&quot;onUpdated();&quot; /&gt; &lt;FadeIn MinimumOpacity=&quot;.5&quot; /&gt; &lt;/Parallel&gt; &lt;/OnUpdated&gt; &lt;/Animations&gt; &lt;/cc1:UpdatePanelAnimationExtender&gt; &lt;div id=&quot;updateProgressDiv&quot; style=&quot;display:none; position:absolute;&quot;&gt; &lt;span style=&quot;color:#fff; margin:3px&quot;&gt; &lt;asp:UpdateProgress ID=&quot;UpdateProgress2&quot; runat=&quot;server&quot;&gt; &lt;ProgressTemplate&gt; &lt;asp:Image ID=&quot;Image2&quot; runat=&quot;server&quot; ImageUrl=&quot;~/Images/loader.gif&quot; /&gt; Loading... &lt;/ProgressTemplate&gt; &lt;/asp:UpdateProgress&gt; &lt;/span&gt; &lt;/div&gt;</pre>&nbsp;&nbsp;<br> <p>Thanks<br> <br> </p> 2008-04-24T14:24:34-04:002321130http://forums.asp.net/p/1252524/2321130.aspx/1?Re+Problems+with+Partial+Page+rendering+on+initial+page+loadRe: Problems with Partial Page rendering on initial page load <p>Anyone with any ideas?&nbsp; I am sure this is a common scenario. I want to load the whole page except the GridView. The GridView needs to be populated asynchronously using the UpdatePanel.</p> <p>How do I do it in Page Load?</p> <p>&nbsp;</p> <p>Thanks</p> <p>HP</p> <p>&nbsp;</p> 2008-04-25T12:50:59-04:002326071http://forums.asp.net/p/1252524/2326071.aspx/1?Re+Problems+with+Partial+Page+rendering+on+initial+page+loadRe: Problems with Partial Page rendering on initial page load <p>&nbsp;I triggere&nbsp; a javascript button click on Page Load, and manually bind the data source on the button click event. But that seems to screw up the postback events. It is calling the databind twice now. </p> <p>Appreciate any help. I am stuck on this one pretty badly. </p> <p>&nbsp;</p> <p>Thanks</p> <p>HP</p> <p>&nbsp;</p> 2008-04-28T21:04:33-04:002330518http://forums.asp.net/p/1252524/2330518.aspx/1?Re+Problems+with+Partial+Page+rendering+on+initial+page+loadRe: Problems with Partial Page rendering on initial page load Is the GridView read-only?&nbsp; If so, you could use <a href="http://encosia.com/2008/02/05/boost-aspnet-performance-with-deferred-content-loading/"> this web service deferred loading technique</a> to do it pretty easily.<br> 2008-04-30T17:09:55-04:002330772http://forums.asp.net/p/1252524/2330772.aspx/1?Re+Problems+with+Partial+Page+rendering+on+initial+page+loadRe: Problems with Partial Page rendering on initial page load <p>&nbsp;Hi <strong>gt1329a </strong>,</p> <p>Thanks for the reply.&nbsp; I have around 20 pages in my application that use GridViews. They all contain dynamic data.&nbsp; Some of them are editable, some are read-only and some are selectable.&nbsp; I want to apply a common approach to partially render all these pages. <br> </p> <p>I got the partial rendering working using this technique.&nbsp;</p> <p>http://encosia.com/2007/07/13/easily-refresh-an-updatepanel-using-javascript/</p> <p>Used __doPosBack(updatePanel1, '') in the Page_Load event. Then I removed the DataSourceID from GridView control and added an onLoad event handler to the UpdatePanel. </p> <p>The OnLoad method then manually binds the Grid to DataSource if there is a postback.&nbsp;</p> <p>The problem is that now it does not display the Progress bar while it is running the async request. I am totally lost as to why should that happen. I do see the progress bar when I manually click the submit button. </p> <p>Any ideas?</p> <p>Thanks</p> <p>HPDotnet&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> 2008-04-30T19:47:33-04:002330843http://forums.asp.net/p/1252524/2330843.aspx/1?Re+Problems+with+Partial+Page+rendering+on+initial+page+loadRe: Problems with Partial Page rendering on initial page load What kind of progress bar are you using?<br> 2008-04-30T20:18:10-04:002330882http://forums.asp.net/p/1252524/2330882.aspx/1?Re+Problems+with+Partial+Page+rendering+on+initial+page+loadRe: Problems with Partial Page rendering on initial page load <p>&nbsp;I am using UpdateProgress in conjunction with the UpdatePanelAnimationExtender. Here's the code snippet:</p> <p>&nbsp;<br> </p> <pre class="prettyprint">&lt;div style=&quot;overflow:scroll;height:85%;border:1px solid;&quot; id=&quot;divGrid&quot;&gt; &lt;asp:UpdatePanel ID=&quot;UpdatePanel1&quot; runat=&quot;server&quot; UpdateMode=&quot;Conditional&quot;&gt; &lt;ContentTemplate&gt; &lt;asp:GridView ID=&quot;GridView1&quot; runat=&quot;server&quot; AllowPaging=&quot;True&quot; AllowSorting=&quot;True&quot; SkinID=&quot;gridView&quot; OnDataBound=&quot;GridView1_OnDataBound&quot; DataSourceID=&quot;ObjectDataSource3&quot;&gt; &lt;Columns&gt; &lt;asp:TemplateField HeaderText=&quot;Select&quot;&gt; &lt;HeaderTemplate&gt; &lt;asp:CheckBox ID=&quot;chkBoxHeader&quot; runat=&quot;server&quot; /&gt; &lt;/HeaderTemplate&gt; &lt;ItemTemplate&gt; &lt;asp:CheckBox ID=&quot;chkBoxRow&quot; runat=&quot;server&quot; /&gt; &lt;/ItemTemplate&gt; &lt;/asp:TemplateField&gt; &lt;/Columns&gt; &lt;/asp:GridView&gt; &lt;asp:Literal ID=&quot;CheckBoxIDsArray&quot; runat=&quot;server&quot; &gt;&lt;/asp:Literal&gt; &lt;input type=&quot;hidden&quot; id=&quot;hdnSelChkBoxIDs&quot; name=&quot;hdnSelChkBoxIDs&quot; value=&quot;&lt;%=selectedHdnString %&gt;&quot;/&gt; &lt;/ContentTemplate&gt; &lt;Triggers&gt; &lt;asp:AsyncPostBackTrigger ControlID=&quot;btnSearch&quot; EventName=&quot;Click&quot; /&gt; &lt;/Triggers&gt; &lt;/asp:UpdatePanel&gt; &lt;/div&gt; &lt;cc1:UpdatePanelAnimationExtender ID=&quot;upae&quot; BehaviorID=&quot;animation&quot; runat=&quot;server&quot; TargetControlID=&quot;updatePanel1&quot;&gt; &lt;Animations&gt; &lt;OnUpdating&gt; &lt;Parallel duration=&quot;0&quot;&gt; &lt;%-- place the update progress div over the gridview control --%&gt; &lt;ScriptAction Script=&quot;onUpdating();&quot; /&gt; &lt;FadeOut MinimumOpacity=&quot;.5&quot; /&gt; &lt;/Parallel&gt; &lt;/OnUpdating&gt; &lt;OnUpdated&gt; &lt;Parallel duration=&quot;0&quot;&gt; &lt;%--find the update progress div and place it over the gridview control--%&gt; &lt;ScriptAction Script=&quot;onUpdated();&quot; /&gt; &lt;FadeIn MinimumOpacity=&quot;.5&quot; /&gt; &lt;/Parallel&gt; &lt;/OnUpdated&gt; &lt;/Animations&gt; &lt;/cc1:UpdatePanelAnimationExtender&gt; &lt;div id=&quot;updateProgressDiv&quot; style=&quot;display:none; position:absolute;&quot;&gt; &lt;span style=&quot;color:#fff; margin:3px&quot;&gt; &lt;asp:UpdateProgress ID=&quot;UpdateProgress2&quot; runat=&quot;server&quot;&gt; &lt;ProgressTemplate&gt; &lt;asp:Image ID=&quot;Image2&quot; runat=&quot;server&quot; ImageUrl=&quot;~/Images/loader.gif&quot; /&gt; Loading... &lt;/ProgressTemplate&gt; &lt;/asp:UpdateProgress&gt; &lt;/span&gt; &lt;/div&gt;</pre>&nbsp;&nbsp; <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> 2008-04-30T20:53:16-04:002330939http://forums.asp.net/p/1252524/2330939.aspx/1?Re+Problems+with+Partial+Page+rendering+on+initial+page+loadRe: Problems with Partial Page rendering on initial page load &nbsp; <p>Sorry, here is the correct code snippet:</p> &nbsp;<pre class="prettyprint">&lt;div style=&quot;overflow:scroll;height:85%;border:1px solid;&quot; id=&quot;divGrid&quot;&gt; &lt;asp:UpdatePanel ID=&quot;UpdatePanel1&quot; runat=&quot;server&quot; UpdateMode=&quot;Conditional&quot; OnLoad=&quot;UpdatePanel1_OnLoad&quot;&gt; &lt;ContentTemplate&gt; &lt;asp:GridView ID=&quot;GridView1&quot; runat=&quot;server&quot; AllowPaging=&quot;True&quot; AllowSorting=&quot;True&quot; SkinID=&quot;gridView&quot; OnDataBound=&quot;GridView1_OnDataBound&quot;&gt; &lt;Columns&gt; &lt;asp:TemplateField HeaderText=&quot;Select&quot;&gt; &lt;HeaderTemplate&gt; &lt;asp:CheckBox ID=&quot;chkBoxHeader&quot; runat=&quot;server&quot; /&gt; &lt;/HeaderTemplate&gt; &lt;ItemTemplate&gt; &lt;asp:CheckBox ID=&quot;chkBoxRow&quot; runat=&quot;server&quot; /&gt; &lt;/ItemTemplate&gt; &lt;/asp:TemplateField&gt; &lt;/Columns&gt; &lt;/asp:GridView&gt; &lt;asp:Literal ID=&quot;CheckBoxIDsArray&quot; runat=&quot;server&quot; &gt;&lt;/asp:Literal&gt; &lt;input type=&quot;hidden&quot; id=&quot;hdnSelChkBoxIDs&quot; name=&quot;hdnSelChkBoxIDs&quot; value=&quot;&lt;%=selectedHdnString %&gt;&quot;/&gt; &lt;/ContentTemplate&gt; &lt;Triggers&gt; &lt;asp:AsyncPostBackTrigger ControlID=&quot;btnSearch&quot; EventName=&quot;Click&quot; /&gt; &lt;/Triggers&gt; &lt;/asp:UpdatePanel&gt; &lt;/div&gt; &lt;cc1:UpdatePanelAnimationExtender ID=&quot;upae&quot; BehaviorID=&quot;animation&quot; runat=&quot;server&quot; TargetControlID=&quot;updatePanel1&quot;&gt; &lt;Animations&gt; &lt;OnUpdating&gt; &lt;Parallel duration=&quot;0&quot;&gt; &lt;%-- place the update progress div over the gridview control --%&gt; &lt;ScriptAction Script=&quot;onUpdating();&quot; /&gt; &lt;FadeOut MinimumOpacity=&quot;.5&quot; /&gt; &lt;/Parallel&gt; &lt;/OnUpdating&gt; &lt;OnUpdated&gt; &lt;Parallel duration=&quot;0&quot;&gt; &lt;%--find the update progress div and place it over the gridview control--%&gt; &lt;ScriptAction Script=&quot;onUpdated();&quot; /&gt; &lt;FadeIn MinimumOpacity=&quot;.5&quot; /&gt; &lt;/Parallel&gt; &lt;/OnUpdated&gt; &lt;/Animations&gt; &lt;/cc1:UpdatePanelAnimationExtender&gt; &lt;div id=&quot;updateProgressDiv&quot; style=&quot;display:none; position:absolute;&quot;&gt; &lt;span style=&quot;color:#fff; margin:3px&quot;&gt; &lt;asp:UpdateProgress ID=&quot;UpdateProgress2&quot; runat=&quot;server&quot;&gt; &lt;ProgressTemplate&gt; &lt;asp:Image ID=&quot;Image2&quot; runat=&quot;server&quot; ImageUrl=&quot;~/Images/loader.gif&quot; /&gt; Loading... &lt;/ProgressTemplate&gt; &lt;/asp:UpdateProgress&gt; &lt;/span&gt; &lt;/div&gt;</pre><br> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> 2008-04-30T21:27:09-04:002332251http://forums.asp.net/p/1252524/2332251.aspx/1?Re+Problems+with+Partial+Page+rendering+on+initial+page+loadRe: Problems with Partial Page rendering on initial page load <p>When I trigger the UpdatePanel by clicking Submit button, I see the progress bar anmation.</p> <p>But when the UpdatePanel is triggered using __doPostBack , I don't see the animation. It doesn't even call the javascript functions. </p> <p>&nbsp; Am I doing anything wrong with the UpdatePanelAnimationExtender??</p> <p>&nbsp;</p> <p>HP</p> <p>&nbsp;</p> 2008-05-01T15:52:38-04:002338490http://forums.asp.net/p/1252524/2338490.aspx/1?Re+Problems+with+Partial+Page+rendering+on+initial+page+loadRe: Problems with Partial Page rendering on initial page load <p>&nbsp;Anyone there? Please help. </p> <p>Why is the progress bar animation not triggered when the page does the&nbsp; __doPostBack? I see the animation when I manually click the submit button.</p> <p>Please help!</p> <p>HP&nbsp;</p> 2008-05-05T17:11:22-04:002340923http://forums.asp.net/p/1252524/2340923.aspx/1?Re+Problems+with+Partial+Page+rendering+on+initial+page+loadRe: Problems with Partial Page rendering on initial page load <p>Sorry for the late response.</p> <p>If I were doing it, I would definitely do it similar to how it's done in my <a href="http://encosia.com/2008/02/05/boost-aspnet-performance-with-deferred-content-loading/"> deferred content loading</a> post.&nbsp; If you use a &quot;fake&quot; loading indicator that is hidden immediately after the page loads, during the __doPostBack, you don't have to rely on more complex mechanisms that are intended for user triggered actions.<br> </p> 2008-05-06T16:49:58-04:002344015http://forums.asp.net/p/1252524/2344015.aspx/1?Re+Problems+with+Partial+Page+rendering+on+initial+page+loadRe: Problems with Partial Page rendering on initial page load <p>&nbsp;Thanks a lot <strong>gt1329a <b>!</b></strong><b> </b></p> <p>I used the CSS technique to display and hide the progress bar as shown in one of your articles - <a href="http://encosia.com/2007/01/16/css-style-as-ajax-progress-indicator/" title="article"> http://encosia.com/2007/01/16/css-style-as-ajax-progress-indicator/</a></p> <p>Got rid of the UpdateProgressAnimationExtender. &nbsp;</p> <p>&nbsp;I am still using the UpdatePanel instead of the recommended web service way as mentioned in your deferred content loading article. I will give it a shot too!</p> <p>&nbsp;Thanks again! Really appreciate it!</p> <p>HP</p> <p><br> &nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> 2008-05-07T19:55:10-04:002344050http://forums.asp.net/p/1252524/2344050.aspx/1?Re+Problems+with+Partial+Page+rendering+on+initial+page+loadRe: Problems with Partial Page rendering on initial page load <p>Glad I could help.</p> <p>Since you have some GridViews that aren't read-only, you should probably avoid the deferred content loading method that I posted about.&nbsp; It's a good solution for read-only grids, but if you need the GridView to be able to trigger and handle postbacks, it won't work for you. <br> </p> 2008-05-07T20:10:41-04:00