I have an old page that was recently retrofitted with UpdatePanels to try and make it a little better until we can do a decent re-write on it. However, we are now having an issue with whitespace disappearing in IE 7 (haven't tried with other versions). The code below is for a very simple form that re-creates the problem. In IE, clicking the button within the update panel causes all the whitespace in the label's text to disappear. This does not happen in Firefox and I have confirmed through Firebug that the spaces are being sent by the server.
So, the real question is, what can I do to fix this? Is there a simple workaround that anyone can think of to fix this until we can re-work the page?
Thanks,
Patrick
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>I'm a piece of junk</title>
<style type="text/css">
.PW
{
white-space:pre;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<br />
<fieldset>
<legend>Not in update panel</legend>
<asp:Label runat="server" ID="lblTest1" CssClass="PW"> I have spaces ! </asp:Label><br />
<asp:Button runat="server" ID="btnTest1" Text="Click Me" />
</fieldset>
<br /><br /><br />
<asp:UpdatePanel runat="server">
<ContentTemplate>
<fieldset>
<legend>In update panel</legend>
<asp:Label runat="server" ID="lblTest2" CssClass="PW"> I have spaces ! </asp:Label><br />
<asp:Button runat="server" ID="btnTest2" Text="Click Me" />
</fieldset>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
</body>
</html>