Full postback happens for controls in a Update Panel

Full page is posted back on a postback event of a control placed in a particular Update panel. While postback for the controls in other update panels or newly made update panels work correctly.

 

Why this might happen?

This might happen if the update panel is places inside a table and has a row of the table inside it.

E.g.

<table>
:
<asp:UpdatePanel ..>
<ContentTemplate>
<tr><td>
:
</td></tr>
</ContentTemplate>
</asp:UpdatePanel>
:
</table>

Simple way to fix or avoid this situation is to place the Update panel outside the table.

One way of doing this is as follows,

<table>
:
</table>
<asp:UpdatePanel ..>
<ContentTemplate>
<table>
<tr><td>
:
</td></tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
<table>
:
</table>

Hope this was helpful to you in someway

Comments

  • Anonymous
    April 06, 2009
    So will it be OK if the update panel is inside the <td>??<table>  <tr><td>     <asp:UpdatePanel ..>         <ContentTemplate>         </ContentTemplate>     </asp:UpdatePanel>  </td></tr></table>
  • Anonymous
    April 06, 2009
    Yes it would work fine if the update panel is inside the <td> tag. Moreover it will even work if it is in the <tr> tag (without the <td>).E.g.<table><tr>    <asp:UpdatePanel ..>        <ContentTemplate>        </ContentTemplate>    </asp:UpdatePanel> </tr></table>Be sure of not adding any <tr> <td> tags inside the <ContentTemplate> element. If you want to use <tr>, <td> tags inside a <ContentTemplate>, add a new table instead and add the element inside it, so that there is no relation between <tr> <td> and a outer table.The idea is to keep the update panel in a complete element and not in between elements.Normally you will not find yourself in this situation on simple pages. But in complex scenarios, after a few changes to the page you might end up doing this.Hope this makes it a bit more clear.
  • Anonymous
    April 07, 2009
    Please note i havent tested this but have you tried:<table><TBODY>...<asp:UpdatePanel ...></asp:UpdatePanel>...</TBODY></table>Note the addition of a TBODY tag: Internet Explorer allows you to omit TBODY when  writing HTML as it will add an implicit TBODY tag beneath the TABLE tag for orphaned rows.  IE at least (i don't believe this restriction applies to other browsers) will only allow you to programattically add rows to a TBODY tag however, so when the UpdatePanel script runs it can't attach the result rows and instead performs a full-page postback.It may not fix the issue but you should give it a try.
  • Anonymous
    April 07, 2009
    Created a sample to test this approch, as expected it dosen't help in resolving the issue.What i feel is that <THEAD>, <TBODY>, <TFOOT> were introduce to give more flexibility and control in managing properties of diffrent sections of a table. They don't not make any change to the DOM, hence are of little use in the full post back issue.
  • Anonymous
    June 22, 2009
    Thanks for the post. This saved me a bunch of time!
  • Anonymous
    June 26, 2009
    i have a updatepanel in my page it works locally well when i post the page to the server the updatepanel causing full postback. what is the problem i am using VS2008 and my web server is also VS2008
  • Anonymous
    March 10, 2012
    <table><tbody>    <asp:UpdatePanel ..>            <ContentTemplate>                      <tr>                     </tr>            </ContentTemplate></asp:UpdatePanel></tbody></table>This the only way to avoid table error