Gets full postback instead of partial

Last post 05-09-2008 4:12 AM by d00mo. 6 replies.

Sort Posts:

  • Gets full postback instead of partial

    05-08-2008, 7:15 AM
    • Loading...
    • d00mo
    • Joined on 06-25-2007, 1:16 PM
    • Posts 23

    I have an application which creates an UpdatePanel dynamically. The UpdatePanel has some checkboxes that should result a partial postback.

    There are two ways to get to the state where the UpdatePanel is created.

    In the first one, the page is rendered for the very first time, i.e Page.IsPostBack == false.

    In the second, the page has display some other content before the UpdatePanel is created, i.e Page.IsPostBack == true when creating the UpdatePanel.

    In the first case, everything works exactly as it should, a partial postback is done when clicking a checkbox.

    In the second case, however, a full postback is generated.

    I have tried to set AutoPostBack = true on the checkboxes (which of course are inside the UpdatePanel), as well as manually setting __doPostBack on the onClick event. Neither works for the latter case, both work for the first case.

    Any ideas?

  • Re: Gets full postback instead of partial

    05-08-2008, 7:43 AM
    • Loading...
    • kamii47
    • Joined on 05-26-2005, 12:04 PM
    • Karachi, Pakistan
    • Posts 1,137

    in page load event register your control which u want's the full post back as

    ScriptManager.GetCurrent(this).RegisterPostBackControl(chkABC);  

     

    Kamran Shahid (MCP,MCAD,MCSD.NET)
    Sr. Software Engineer
    Netprosys Inc.
    www.netprosys.com
    [Microsoft Gold Certified Partner]
  • Re: Gets full postback instead of partial

    05-08-2008, 7:44 AM
    • Loading...
    • Mahadeomatre
    • Joined on 04-23-2007, 11:00 AM
    • Pune, India
    • Posts 190

    use the Updatepanels PostbackTrigger.

    add ur checkbox control in this postback trigger

    <asp:UpdatePanel ID="UpdatePanel1" runat="server">

    <ContentTemplate>

    <asp:TextBox ID="TextBox1" runat="server" AutoPostBack="True" OnTextChanged="TextBox1_TextChanged" ></asp:TextBox>

    <asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="True" OnCheckedChanged="CheckBox1_CheckedChanged" /><br />

    <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>

    </ContentTemplate>

    <Triggers>

    <asp:PostBackTrigger ControlID="CheckBox1" />

    </Triggers>

    </asp:UpdatePanel>

     

     

    Thanks,
    Mahadeo

    -----------------------------------------------
    Best is Not the END point, but a starting point for Innovation
    ------------------------------------------------
    Remember to mark posts as the "Answer" to help future users.
  • Re: Gets full postback instead of partial

    05-08-2008, 9:04 AM
    • Loading...
    • d00mo
    • Joined on 06-25-2007, 1:16 PM
    • Posts 23

    Thanks for your replies.

    I tried registering the CheckBoxes with 

    System.Web.UI.ScriptManager.GetCurrent(Page).RegisterAsyncPostBackControl(cb);

     but the result is the same. But shouldn't this control be registered automatically by default, since it is within the UpdatePanel?

    The other way, adding an Trigger to the UpdatePanel doesn't seem to work either, but according to the spec it shouldn't be supported: "Programmatically adding AsyncPostBackTrigger controls is not supported..."

     

    Any more ideas?

  • Re: Gets full postback instead of partial

    05-09-2008, 3:15 AM
    • Loading...
    • d00mo
    • Joined on 06-25-2007, 1:16 PM
    • Posts 23

    Reading your suggestions again I realize that my question perhaps wasn't clear enough.

    I DON'T want a full postbcak, only a partial. My problem is that my control generate a full post when it only should generate a partial. The control is within an UpdatePanel, and the error only occurs in one of two scenarios (described above).

  • Re: Gets full postback instead of partial

    05-09-2008, 3:19 AM
    • Loading...
    • kamii47
    • Joined on 05-26-2005, 12:04 PM
    • Karachi, Pakistan
    • Posts 1,137

    OOPS. Confusing.

    Now Problem is that u are experiencing Full PostBack But U want's partial PostBack {Is it correct ??}

    Kamran Shahid (MCP,MCAD,MCSD.NET)
    Sr. Software Engineer
    Netprosys Inc.
    www.netprosys.com
    [Microsoft Gold Certified Partner]
  • Re: Gets full postback instead of partial

    05-09-2008, 4:12 AM
    • Loading...
    • d00mo
    • Joined on 06-25-2007, 1:16 PM
    • Posts 23

    Yes, that is correct.

    And if the UpdatePanel is created on a PostBack of the page it doesn't work.

    If the UpdatePanel is created on a Non-PostBack page it works.

Page 1 of 1 (7 items)