2009-05-10 Marek Habersack <mhabersack@novell.com>
authorMarek Habersack <grendel@twistedcode.net>
Sun, 10 May 2009 20:29:01 +0000 (20:29 -0000)
committerMarek Habersack <grendel@twistedcode.net>
Sun, 10 May 2009 20:29:01 +0000 (20:29 -0000)
* Makefile (TEST_RESOURCE_FILES): added
Test/mainsoft/NunitWebResources/ExpressionInListControl.aspx

2009-05-10  Marek Habersack  <mhabersack@novell.com>

* AspGenerator.cs: keep processing the tag if it is not a server
one and contains expressions and no code render blocks.

2009-05-10  Marek Habersack  <mhabersack@novell.com>

* TemplateControlCompilerTest.cs: added a test for expressions in
list control items.

svn path=/trunk/mcs/; revision=133861

mcs/class/System.Web/ChangeLog
mcs/class/System.Web/Makefile
mcs/class/System.Web/System.Web.Compilation/AspGenerator.cs
mcs/class/System.Web/System.Web.Compilation/ChangeLog
mcs/class/System.Web/System.Web.UI/CollectionBuilder.cs
mcs/class/System.Web/Test/System.Web.Compilation/ChangeLog
mcs/class/System.Web/Test/System.Web.Compilation/TemplateControlCompilerTest.cs
mcs/class/System.Web/Test/mainsoft/NunitWebResources/ExpressionInListControl.aspx [new file with mode: 0644]

index add923a96c7b55a0b4d32aa57e01c6c343d2c719..0dbb72e7ff6422ee70131b6d354fa4f2982babdf 100644 (file)
@@ -1,3 +1,8 @@
+2009-05-10  Marek Habersack  <mhabersack@novell.com>
+
+       * Makefile (TEST_RESOURCE_FILES): added
+       Test/mainsoft/NunitWebResources/ExpressionInListControl.aspx
+
 2009-04-28  Marek Habersack  <mhabersack@novell.com>
 
        * Makefile (TEST_RESOURCE_FILES): added
index db52132f80b977f2d580fd210b0df486752844f1..aa76e36e29f55b3d2aa455d9f97b883cdcb41b87 100644 (file)
@@ -167,7 +167,8 @@ TEST_RESOURCE_FILES = \
        Test/mainsoft/NunitWebResources/NoDoubleOnInitOnRemoveAdd.aspx.cs \
        Test/mainsoft/NunitWebResources/LoginDisplayRememberMe.aspx \
        Test/mainsoft/NunitWebResources/NoBindForMethodsWithBindInName.aspx \
-       Test/mainsoft/NunitWebResources/LinkInHeadWithEmbeddedExpression.aspx
+       Test/mainsoft/NunitWebResources/LinkInHeadWithEmbeddedExpression.aspx \
+       Test/mainsoft/NunitWebResources/ExpressionInListControl.aspx
 
 RESX_DIST =  resources/TranslationResources.resx
 ifeq (net_2_0, $(PROFILE))
index ce780d41dc889d15d84a88d62c0531d1cf3f8970..ed61bb8087f7a45dc3c621b4a97872f6787cdfa6 100644 (file)
@@ -1072,7 +1072,10 @@ namespace System.Web.Compilation
                        if (builder == null)
                                return false;
 
-                       if (!runatServer && location.PlainText.IndexOf ("<%") > -1)
+                       // This is as good as we can do for now - if the parsed location contains
+                       // both expressions and code render blocks then we're out of luck...
+                       string plainText = location.PlainText;
+                       if (!runatServer && plainText.IndexOf ("<%$") == -1&& plainText.IndexOf ("<%") > -1)
                                return false;
 #if NET_2_0
                        PageParserFilter pfilter = PageParserFilter;
@@ -1385,7 +1388,9 @@ namespace System.Web.Compilation
                                                break;
                                                
                                        default:
-                                               builder.AppendLiteralString (location.PlainText);
+                                               string text = location.PlainText;
+                                               if (text != null && text.Trim ().Length > 0)
+                                                       builder.AppendLiteralString (text);
                                                break;
                                }
                        }
index defe220c6f114757fa155ca53dbc12993af55fbd..b11048aebca458fbf1131c6d56fc766655b303b0 100644 (file)
@@ -1,3 +1,8 @@
+2009-05-10  Marek Habersack  <mhabersack@novell.com>
+
+       * AspGenerator.cs: keep processing the tag if it is not a server
+       one and contains expressions and no code render blocks.
+
 2009-05-05  Marek Habersack  <mhabersack@novell.com>
 
        * BuildManager.cs: RemoveFailedAssemblies wraps the compilation
index 8582e3a88da99536d30fc4db5119c2b760691535..00076d55ea0b68920cbaf6b3b738755f3a366793 100644 (file)
@@ -44,7 +44,7 @@ namespace System.Web.UI
 
                public override void AppendLiteralString (string s)
                {
-                       if (s != null && s.Trim () != "")
+                       if (s != null && s.Trim ().Length > 0)
                                throw new HttpException ("Literal content not allowed for " + ControlType);
                }
 
index f6bd1ed9c4344a2c43aca4b8dd6ed6e1cd836a7b..bd14646cf2aed7cf35dbe9288d637efe4d2e348c 100644 (file)
@@ -1,3 +1,8 @@
+2009-05-10  Marek Habersack  <mhabersack@novell.com>
+
+       * TemplateControlCompilerTest.cs: added a test for expressions in
+       list control items.
+
 2009-04-28  Marek Habersack  <mhabersack@novell.com>
 
        * TemplateControlCompilerTest.cs: added test for bug #498637
index b7ae0e43b3495accf6919609b0c462d3276167ef..b9bb89fcd3995d4f21ee19d24fa9afb0910a262d 100644 (file)
@@ -68,6 +68,7 @@ namespace MonoTests.System.Web.Compilation {
                        WebTest.CopyResource (GetType (), "ContentPlaceHolderInTemplate.aspx", "ContentPlaceHolderInTemplate.aspx");
                        WebTest.CopyResource (GetType (), "ContentPlaceHolderInTemplate.master", "ContentPlaceHolderInTemplate.master");
                        WebTest.CopyResource (GetType (), "LinkInHeadWithEmbeddedExpression.aspx", "LinkInHeadWithEmbeddedExpression.aspx");
+                       WebTest.CopyResource (GetType (), "ExpressionInListControl.aspx", "ExpressionInListControl.aspx");
 #endif
                }
                
@@ -168,6 +169,18 @@ namespace MonoTests.System.Web.Compilation {
 
                        HtmlDiff.AssertAreEqual (originalHtml, renderedHtml, "#A1");
                }
+
+               [Test]
+               public void ExpressionInListControl ()
+               {
+                       string pageHtml = new WebTest ("ExpressionInListControl.aspx").Run ();
+                       string renderedHtml = HtmlDiff.GetControlFromPageHtml (pageHtml);
+                       string originalHtml = @"<select name=""DropDown1"" id=""DropDown1"">
+       <option value=""strvalue"">str</option>
+
+</select>";
+                       HtmlDiff.AssertAreEqual (originalHtml, renderedHtml, "#A1");
+               }
 #endif
                
                [Test]
diff --git a/mcs/class/System.Web/Test/mainsoft/NunitWebResources/ExpressionInListControl.aspx b/mcs/class/System.Web/Test/mainsoft/NunitWebResources/ExpressionInListControl.aspx
new file mode 100644 (file)
index 0000000..ef06fc0
--- /dev/null
@@ -0,0 +1,16 @@
+<%@ Page Language="C#" AutoEventWireup="true" CodeFile="MyPage.aspx.cs" Inherits="MyPage" %>
+
+<!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>Untitled Page</title>
+</head>
+<body>
+    <form id="form1" runat="server">
+    <div>
+    <%= MonoTests.stand_alone.WebHarness.HtmlDiff.BEGIN_TAG %><asp:DropDownList runat="server" id="DropDown1"><asp:ListItem Text="<%$ AppSettings:strvalue %>" Value="strvalue"/></asp:DropDownList><%= MonoTests.stand_alone.WebHarness.HtmlDiff.END_TAG %>
+    </div>
+    </form>
+</body>
+</html>