locked
Will the Control inside the Ajax update panel causes entire page posted to server or only the ajax update panel alone is posted to server? RRS feed

  • Question

  • User1094269964 posted

    Will the Control inside the  Ajax update panel causes entire page posted to server or only  the ajax update panel alone is posted to server?

    People saying partial rendering but i don't understand about the postback...is it only the updatepanel alone go for post back (partial postback) or the entire page will go for postback and the server will update only partial page (only the update panel?

    Friday, July 4, 2014 9:00 AM

Answers

  • User-1360095595 posted

    1. Yes. 

    2. Try changing the value of the TextBox (that's outside) in page_load for example. Do you see the updated value? [Hint: the answer is no].

    Summary: full postback (entire page life cycle), partial rendering (content of updatepanel), as I stated several replies prior. 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, July 7, 2014 5:38 AM

All replies

  • User-1360095595 posted

    It's a full postback and partial rendering. So it's just like a regular postback but only the ui inside the updatepanel that gets updated. 

    Friday, July 4, 2014 12:31 PM
  • User-417640953 posted

    is it only the updatepanel alone go for post back (partial postback) or the entire page will go for postback and the server will update only partial page (only the update panel?

    Hi bsurendiran,

    Thanks for your post.

    As other member mentioned, the UpdatePanel control designed to asynchronous and partial refresh asp.net page.

    And if you do a async postback, the page only update the content which inside a UpdatePanel. 

    Besides, no matter full postback or async postback, it will postback entire page to server side. If it is the async postback, page will only update

    the content which wraped in a UpdatePanel. For learn more about it, I suggest you follow below source.

    # Asp.net PostBack.

    http://stackoverflow.com/questions/4251157/what-is-a-postback

    http://www.c-sharpcorner.com/uploadfile/2f73dd/what-is-postback-in-Asp-Net/

    # UpdatePanel Control Overview

    http://msdn.microsoft.com/en-us/library/vstudio/bb386454(v=vs.100).aspx

    Hope that helps, thanks.

    Best Regards!

    Sunday, July 6, 2014 9:46 PM
  • User555306248 posted

    That’s the way the UpdatePanel works, it just hides de postback from the user, it’s called a partial-postback, but the page still goes through the whole page life cycle, if you want to avoid the postback altogether then you can use ASP.NET AJAX or jQuery to call a WebService (or PageMethod), it’s harder to code, but it’s also a lot faster and uses less resources, if interested check this link.

    The UpdatePanel's Load, Prerender, etc events will fire even if they belong to an UpdatePanel that isn't being updated.  You can verify by viewing a trace or stepping through breakpoints in the debugger.  It's a bit counter intuitive at first, but makes sense in the context of what's actually happening.

    Sunday, July 6, 2014 11:45 PM
  • User-1569093213 posted

    Thanks for posting the Forum

    See Basically In General when u r using buttons or some events at that time whole page get posted back to server and u get the updated data from the sever in html format...but when u use update panel the conrols inside the update panel do the post back but not an as whole page..its just post back the panel and panel control.....

    on button click only the controls inside the update panel are getting posted back and the value is getting reset....and the value is not getting assigned to another textbopx

    <body>
        <form id="form1" runat="server">
        <div>
            <asp:ScriptManager ID="ScriptManager1" runat="server">
            </asp:ScriptManager>
            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
               <ContentTemplate>
               <asp:TextBox ID="txtName" runat="server"></asp:TextBox>
               <asp:Button ID="btnSave" runat="server" Text="Save" onclick="btnSave_Click" />
               </ContentTemplate>
    using System.Web.UI.WebControls;
    
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
    
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            txtSample.Text = txtName.Text;
        }
    }

    </asp:UpdatePanel> <asp:TextBox ID="txtSample" runat="server"></asp:TextBox> </div> </form> </body>
    Monday, July 7, 2014 12:18 AM
  • User1094269964 posted

    Thanks,

    As per your code i have observed the below items and requesting you to validate my understanding

    1. when ever the user clicks the button (btnSave) the complete page is going to post back not the control in the Updatepanel alone going for post back. So we can very well say the it doesnt matter whether we are using ajax updatepanel or not..any button click either in the updatepanel or outside the updatepanel will cause the complete postback
    2. I have added the OnPreRender for the textbox outside the Updatepanel..So when you say if the button inside the updatepanel is clicked it will refresh only the content in the updatepanel. if this is the case how come the OnPreRender event of the textbox which is placed outside the updatepenel is getting executed ?
          <asp:TextBox ID="txtSample" runat="server" OnPreRender="txtSample_PreRender"></asp:TextBox>
      
    Monday, July 7, 2014 5:20 AM
  • User-1360095595 posted

    1. Yes. 

    2. Try changing the value of the TextBox (that's outside) in page_load for example. Do you see the updated value? [Hint: the answer is no].

    Summary: full postback (entire page life cycle), partial rendering (content of updatepanel), as I stated several replies prior. 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, July 7, 2014 5:38 AM