2008-01-08 Marek Habersack <mhabersack@novell.com>
authorMarek Habersack <grendel@twistedcode.net>
Tue, 8 Jan 2008 15:03:20 +0000 (15:03 -0000)
committerMarek Habersack <grendel@twistedcode.net>
Tue, 8 Jan 2008 15:03:20 +0000 (15:03 -0000)
* TemplateControlCompiler.cs: statements to assign
fields/properties from resources must be processed at the very end
of the control creation method. Some controls (like HyperLink) can
set their Text attribute using literal content. In such cases, in
order to properly localize the control, the value read from the
local page resources must be assigned after the literal value has
been added to the control. Fixes bug #323494

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

mcs/class/System.Web/System.Web.Compilation/ChangeLog
mcs/class/System.Web/System.Web.Compilation/TemplateControlCompiler.cs

index 92c34f43bf0f540b8eca64c7416f07c4d4c1790f..9e5210348df45591bbee3372720066ac4a12d5d9 100644 (file)
@@ -1,3 +1,13 @@
+2008-01-08  Marek Habersack  <mhabersack@novell.com>
+
+       * TemplateControlCompiler.cs: statements to assign
+       fields/properties from resources must be processed at the very end
+       of the control creation method. Some controls (like HyperLink) can
+       set their Text attribute using literal content. In such cases, in
+       order to properly localize the control, the value read from the
+       local page resources must be assigned after the literal value has
+       been added to the control. Fixes bug #323494
+
 2008-01-07  Marek Habersack  <mhabersack@novell.com>
 
        * CachingCompiler.cs: added an overload to the Compile method
index 0ae131e9704308597a9e8a74a0b957b25414fef6..f86b1ee1c406ab4d59a17ac4f21841c97612b677 100644 (file)
@@ -896,9 +896,6 @@ namespace System.Web.Compilation
 
                protected void CreateAssignStatementsFromAttributes (ControlBuilder builder)
                {
-#if NET_2_0
-                       bool haveMetaKey = false;
-#endif
                        this.dataBoundAtts = 0;
                        IDictionary atts = builder.attribs;
                        if (atts == null || atts.Count == 0)
@@ -915,18 +912,12 @@ namespace System.Web.Compilation
                                /* we skip SkinID here as it's assigned in BuildControlTree */
                                if (InvariantCompareNoCase (id, "skinid"))
                                        continue;
-                               if (InvariantCompareNoCase (id, "meta:resourcekey")) {
-                                       haveMetaKey = true;
-                                       continue;
-                               }
+                               if (InvariantCompareNoCase (id, "meta:resourcekey"))
+                                       continue; // ignore, this one's processed at the very end of
+                                                 // the method
 #endif
                                CreateAssignStatementFromAttribute (builder, id);
                        }
-                       
-#if NET_2_0
-                       if (haveMetaKey)
-                               CreateAssignStatementFromAttribute (builder, "meta:resourcekey");
-#endif
                }
 
                void CreateDBAttributeMethod (ControlBuilder builder, string attr, string code)
@@ -1416,15 +1407,18 @@ namespace System.Web.Compilation
 
                                builder.methodStatements.Add (invoke);
                        }
-                       
-                       if (!childrenAsProperties && typeof (Control).IsAssignableFrom (builder.ControlType))
-                               builder.method.Statements.Add (new CodeMethodReturnStatement (ctrlVar));
 
 #if NET_2_0
                        if (builder is RootBuilder)
                                if (!String.IsNullOrEmpty (parser.MetaResourceKey))
                                        AssignPropertiesFromResources (builder, parser.BaseType, parser.MetaResourceKey);
+                       
+                       if ((!isTemplate || builder is RootBuilder) && builder.attribs != null && builder.attribs ["meta:resourcekey"] != null)
+                               CreateAssignStatementFromAttribute (builder, "meta:resourcekey");
 #endif
+
+                       if (!childrenAsProperties && typeof (Control).IsAssignableFrom (builder.ControlType))
+                               builder.method.Statements.Add (new CodeMethodReturnStatement (ctrlVar));
                }
                
                protected internal override void CreateMethods ()