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 (7)

  1. Bill Maher says:

    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>

  2. A K Gaonkar says:

    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.

  3. Ron Buckton says:

    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.

  4. A K Gaonkar says:

    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.

  5. Bob Hill says:

    Thanks for the post. This saved me a bunch of time!

  6. senthilkumar says:

    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

  7. Anthony says:

    <table>

    <tbody>    

    <asp:UpdatePanel ..>

                <ContentTemplate>

                          <tr>

                         </tr>

                </ContentTemplate>

    </asp:UpdatePanel>

    </tbody>

    </table>

    This the only way to avoid table error

Skip to main content