Everything was working perfectly until I added a <script type="text/javascript"> section in the header and added a function. Now Atlas doesn't work any more. The page I created is simply a listbox, button and a label. When the button is pushed items are added to the list box and the label text is changed. With the javascript function in the code, nothing happens when I click the button. It works if the "hasOptions" function is removed. Is this a bug, or am I just doing something wrong?
Here is the aspx code:
<%@dotnet.itags.org. Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title>Untitled Page</title> <script type="text/javascript"> function hasOptions(obj) { if (obj != null && obj.options != null) { return true; } return false; } </script></head><body><form id="form1" runat="server"> <atlas:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true" /> <br /> <atlas:UpdatePanel ID="TableUpdatePanel" runat="server" Mode="Conditional"> <ContentTemplate> <asp:ListBox ID="listbox" runat="server"> <asp:ListItem Text="Hello"></asp:ListItem> </asp:ListBox> <asp:Button ID="button" runat="server" OnClick="button_Click" Text="Push Me!" /><br /> <asp:Label ID="label" runat="server"></asp:Label> </ContentTemplate> </atlas:UpdatePanel> </form></body></html>
And here is the Code Behind:
using System;using System.Data;using System.Configuration;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;public partialclass _Default : System.Web.UI.Page {protected void Page_Load(object sender, EventArgs e) { }protected void button_Click(object sender, EventArgs e) { listbox.Items.Add("Test"); listbox.Items.Add("Test"); listbox.Items.Add("Test"); listbox.Items.Add("Test"); listbox.Items.Add("Test"); label.Text ="This worked!"; }}
Hi,
I recently posted a message regarding your problem.
Try commenting out the IF statement with the && logical and operator,
that should fix your problem, seriously :)
I assume this is caused by a bug in the Atlas framework.
Every response returned from a partial update is treated as an XML document (you can use WebDevHelper to monitor the HTTP traffic and see this) and because '&' is a special xml charachter it confuses the Xml Parser and causes the Partial Rendering to fail.
I'm still waiting for a reply from for my post regarding this issue.
My Post:
http://forums.asp.net/thread/1267658.aspx
Have fun,
Lidor Pergament.
No comments:
Post a Comment