Monday, March 26, 2012

Atlas UpdatePanel Browser Hang

I am currently creating a web page utilizing the April Atlas CTP. On my web page there is a dropdown list, a listbox, and two buttons for add and remove. The goal is to allow the user to select an item from the drop down and move it to the listbox. The selected item is then removed from the dropdown control. Removing an item does the same but from the listbox to the dropdown.

Here is the web page snippet:

<asp:Content ID="newJobContent" ContentPlaceHolderID="mainContentArea" runat="Server">
<atlas:ScriptManager ID="scriptManager" runat="server" EnablePartialRendering="True">
</atlas:ScriptManager>
...

<div id="artist_area" style="border: solid 1px black">
Artist(s):
<atlas:UpdatePanel ID="panelArtistDropDown" runat="server">
<ContentTemplate>
<asp:DropDownList ID="ddlArtist" runat="server" CssClass="control" Width="150">
</asp:DropDownList>
<asp:ListBox ID="lstArtist" runat="server" CssClass="control" Rows="4" Width="200"> </asp:ListBox>
</ContentTemplate>
<Triggers>
<atlas:ControlEventTrigger ControlID="btnAdd" EventName="Click" />
<atlas:ControlEventTrigger ControlID="btnRemove" EventName="Click" />
</Triggers>
</atlas:UpdatePanel>
<asp:Button ID="btnRemove" runat="server" OnClick="btnRemove_Click" Text="<" />
<asp:Button ID="btnAdd" runat="server" OnClick="btnAdd_Click" Text=">" />
<asp:CustomValidator ID="valCustArtist" runat="server" ClientValidationFunction="CheckArtist" ControlToValidate="lstArtist" ErrorMessage="You must select an artist(s)." ValidateEmptyText="True"></asp:CustomValidator>
</div
And here's the server side code:

protected void btnAdd_Click(object sender, EventArgs e)
{
ListItem li = new ListItem();

li.Value = ddlArtist.SelectedItem.Value;
li.Text = ddlArtist.SelectedItem.Text;

lstArtist.Items.Add(li);
ddlArtist.Items.Remove(li);
}
protected void btnRemove_Click(object sender, EventArgs e)
{
ListItem li = new ListItem();

li.Value = lstArtist.SelectedItem.Value;
li.Text = lstArtist.SelectedItem.Text;

ddlArtist.Items.Add(li);
ddlArtist.Items.Remove(li);
}

Here's the problem... in IE6 I can add or remove 2 items. On the third try the browser will hang. The code behind is never called. The only way to get control back is to refresh the page. With FireFox everything works great. Very strange. Has anyone experienced this? Any help would be appreciated.I've tracked down the problem. Seems like a third party tool that we use (BasicDatePicker) is causing the problem. When we remove the third party control IE works as it should. Frankly I'm not too surprised because BasicDatePicker generates a ton of javascript. Looks like I'll be coming up with a new date control ;)

No comments:

Post a Comment