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

前端 未结 11 1758
我在风中等你
我在风中等你 2020-12-10 05:13

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 pag

相关标签:
11条回答
  • 2020-12-10 06:01

    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!

    0 讨论(0)
  • 2020-12-10 06:02

    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"

    0 讨论(0)
  • 2020-12-10 06:04

    How do you bind your DropDown? The code that you have provided works on my side with static items. Perhaps it is something in the other controls that is causing the problem.

    I have noticed that your UpdatePanel has its UpdateMode property set to conditional, however you haven't defined any triggers.You can try to explicitly set that the update panel should perform async postback when your dropdown triggers its selectedIndexChanged event. You can use something like the following markup:

    <asp:UpdatePanel ID="upMain" runat="server" UpdateMode="Conditional" Visible="true"
        RenderMode="Inline">
        <ContentTemplate>
            <asp:DropDownList ID="ddlNewService_PortTelco" runat="server" Width="250" 
                AutoPostBack="true" OnSelectedIndexChanged="Provision_PortedTelcoChanged">
            </asp:DropDownList>
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="ddlNewService_PortTelco" EventName="SelectedIndexChanged" />
        </Triggers>
    </asp:UpdatePanel>
    
    0 讨论(0)
  • 2020-12-10 06:05

    If you have some asp component with Autopostback="true" and ClientIdMode="Static", you have to use the trigger.

    Like this:

    <asp:UpdatePanel ID="upPrinceOffuce" runat="server">
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="ddlPrintOffice" EventName="SelectedIndexChanged" />
        </Triggers>
        <ContentTemplate>
             <asp:DropDownList ID="ddlPrintOffice" runat="server" ClientIDMode="Static" AutoPostBack="true" ...blah blah
    </asp:DropDownList>
        </ContentTemplate>
    </asp:UpdatePanel>
    
    0 讨论(0)
  • 2020-12-10 06:07

    Had the same problem when the Dropdownlist Autopostback attribute was set to true and fixed the problem by adding the dropdownlist ID to the updatepanel trigger

    0 讨论(0)
提交回复
热议问题