strange behavior with updatepanel

B

benji

Hi,

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?
Thanks!

-Ben

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


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>

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

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


</asp:UpdatePanel>
</form>
</body>
</html>
 
P

Pete Hurst

benji said:
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:
[snip]

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
 
B

benji

Wow, thank you!

Pete Hurst said:
benji said:
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:
[snip]

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
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,056
Messages
2,570,440
Members
47,101
Latest member
DoloresHol

Latest Threads

Top