strange behavior with updatepanel

Discussion in 'ASP .Net' started by benji, Apr 22, 2009.

  1. benji

    benji Guest


    I'm using ASP.NET 3.5 SP1, and I've managed to get a sample app that
    reproduces some very odd behavior. Let me describe:

    There is an updatepanel with a few controls. Among them, a button.
    1) The button should cause an async postback, but if you hit the button
    immediately after loading, you get a full page refresh.
    2) If you hit a radiobutton first, you will correctlyg get an async
    postback. However, you will then get a SECOND copy of the same button
    generated in the web browser. Now with these two buttons, the behavior is
    different. The top one (dynamically generated during the async postback)
    correctly triggers an async postback when pressed. The bottom button, just as
    originally, still causes a full page postback.

    Could someone please help me understand this?


    <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="WebForm1.aspx.vb"
    Inherits="RCHTemplatesManager.WebForm1" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    <html xmlns="">
    <head id="Head1" runat="server">
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">

    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <asp:RadioButtonList ID="TemplateTypeRBList"
    AutoPostBack="true" RepeatDirection="Horizontal"
    <asp:ListItem Text="Type 2 Template" Value="Type2" />
    <asp:ListItem Text="Type 1 Template" Value="Type1" />
    <asp:DropDownList ID="DropDownList1"
    runat="server" AutoPostBack="True">

    <asp:Label Text="Test" runat="server" ID="Wo" />
    <asp:Button ID="Button1" runat="server" Text="Button" />

    benji, Apr 22, 2009
    1. Advertisements

  2. benji

    Pete Hurst Guest


    You have an orphan </div> part-way through your ContentTemplate, after
    </asp:DropDownList>. This is incorrectly closing the update div too early
    and causing the strange behaviour.

    The real issue is, why isn't this throwing a warning in VS? Normally there
    would be a validation error pointing you straight at it.

    Anyway, removing the </div> fixes the page.

    Pete Hurst, Apr 23, 2009
    1. Advertisements

  3. benji

    benji Guest

    Wow, thank you!

    benji, Apr 23, 2009
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.