Drop Down List (in Update Panel) causing FULL PostBack!

46,374

Solution 1

i had the same problem... altho it's not showing in the copied code here, check to make sure you don't have any controls with ClientIDMode=Static within the updatepanel .... make them inherit

at least any controls that may trigger a postback

Solution 2

Me having the same problem...

CHECK your WEB.CONFIG

<xhtmlConformance mode="Legacy"/>

for this line.. and JUST REMOVE IT!!

Worked for me. Thanks http://andrew-murphy.co.uk/?p=152

Solution 3

You have your drop down list with an AutoPostBack set to true. That's why you have it post back instead of AsyncPostBack, if that is what you wanted.

Remove the AutoPostBack=true from the dropdownlist and set an Async trigger for your UpdatePanel set to the dropdownlist and its eventname="SelectedIndexChanged"

Solution 4

Setting the AutoPostBack attribute to true should be enough to cause a partial postback but it's not what happens and a full postback is triggered instead as you correctly described.

The following workaround works for me:

  1. Drop the AutoPostBack attribute.
  2. Trigger the postback using the "onchange" client side event.

This is how the original DropDownList should look like:

<asp:DropDownList ID="ddlNewService_PortTelco" runat="server" Width="250" CssClass="dropdown" OnChange="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(this.name, '', true, '', '', false, true))" OnSelectedIndexChanged="Provision_PortedTelcoChanged"></asp:DropDownList>

For more details regarding the WebForm_PostBackOptions parameters see below:

function WebForm_PostBackOptions(eventTarget, eventArgument, validation, validationGroup, actionUrl, trackFocus, clientSubmit)

http://msdn.microsoft.com/en-us/library/system.web.ui.postbackoptions_members(v=VS.90).aspx

Solution 5

Excuse my lack of programing skills :| It all worked all the time, but because one of the actions page "looked" like it's POST BACKED, when it wasn't. What a shame!!!

Sorry for waisting Your time!

Share:
46,374
user259119
Author by

user259119

Updated on July 09, 2022

Comments

  • user259119
    user259119 almost 2 years

    I have a problem with my AJAX and ASP.NET 3.5 :( Problem is really weird, as I'm using the same thing on different page and it works fine in there, but on this specific page, this is not working.

    Here's what I have:

        <asp:UpdatePanel ID="upMain" runat="server" UpdateMode="Conditional" Visible="true" RenderMode="Inline">
                    <ContentTemplate>
    <asp:DropDownList ID="ddlNewService_PortTelco" runat="server" Width="250" CssClass="dropdown" AutoPostBack="true" OnSelectedIndexChanged="Provision_PortedTelcoChanged"></asp:DropDownList>
    </ContentTemplate>
    </asp:UpdatePanel>
    

    On the way before the DropDown there is one DIV (html one), and then few asp:Panels. I do not understand why this is causing a FULL POST BACK ?!

    Any ideas ? Thanks

  • user259119
    user259119 over 14 years
    Hi! Thanks for a reply. I tried adding AsyncPostBack trigger as well, but it didn't help. It's not in my example, as for what I know if an OBJECT causing an Update is INSIDE Update Panel then You don't need to specify the Trigger. Triggers are required for Objects OUTSIDE the UpdatePanel. I tried changing UpdateMode to Always, but that didn't help as well. I'm already playing with the code, and I noticed that when I created OTHER UpdatePanel just after this one, and I added identical code inside it worked well :/ So there must be something inside this UpdatePanel which makes it work wrong.
  • Kagawa
    Kagawa over 11 years
    I have the exact same issue as OP described, and I have my dropdownlist with ClientIDMode="Static" too. Removing ClientIDMode just solved it! I wouldn't have found it if you didn't mention about this!
  • Chani Poz
    Chani Poz over 10 years
    you can determine if the page did full postback or partial postback here: stackoverflow.com/questions/15893011/…
  • Nuno Agapito
    Nuno Agapito about 10 years
    Changing to inherit might not be enough. If the application default or parents are with ClientMode static, inherit will not solve the problem. It must be set to AutoID or Predictable to garantee that will generate the correct clientID
  • SearchForKnowledge
    SearchForKnowledge almost 9 years
    When I use trigger, it can't find the DropDownList... stackoverflow.com/questions/30352866/…
  • SearchForKnowledge
    SearchForKnowledge almost 9 years
    Can't find AjaxControlToolkit
  • n8wrl
    n8wrl about 8 years
    This was my problem too! Oh man THAT is not obvious. Thank you!
  • Leo
    Leo about 4 years
    It is a solution, If you meet this problem when you use bootstrap select (dropdownlist) in an updatepanel.
  • Sebazzz
    Sebazzz over 2 years
    Alternatively you can add manual AsyncPostBackTriggers for these dropdowns with ClientIDMode="Static".