Drop Down List (in Update Panel) causing FULL Post

2019-01-18 12:57发布

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

11条回答
时光不老,我们不散
2楼-- · 2019-01-18 13:29

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

查看更多
爷、活的狠高调
3楼-- · 2019-01-18 13:30

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!

查看更多
Juvenile、少年°
4楼-- · 2019-01-18 13:33

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>
查看更多
在下西门庆
5楼-- · 2019-01-18 13:40

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

查看更多
相关推荐>>
6楼-- · 2019-01-18 13:42

I had this problem. My Dropdownlist was inside of an HTML table and I had my Update Panel wrapped around two individual rows. I fixed the problem by wrapping the Update Panel around the entire table rather than just the two rows.

查看更多
登录 后发表回答