Author: mhabersack
Date: 2007-08-29 08:37:35 -0400 (Wed, 29 Aug 2007)
New Revision: 84996
Modified:
trunk/mcs/class/System.Web/System.Web.Compilation/ChangeLog
trunk/mcs/class/System.Web/System.Web.Compilation/TemplateControlCompiler.cs
trunk/mcs/class/System.Web/System.Web.UI/ChangeLog
trunk/mcs/class/System.Web/System.Web.UI/TemplateBuilder.cs
Log:
2007-08-29 Marek Habersack <[EMAIL PROTECTED]>
* TemplateBuilder.cs: check for and store for later use the
TemplateContainerAttribute. Added a nullable property
TemplateInstance to return the value of the attribute.
2007-08-29 Marek Habersack <[EMAIL PROTECTED]>
* TemplateControlCompiler.cs: mark fields corresponding to the
controls as global references.
When control tree is constructed and the parent of the current
builder is a TemplateBuilder marked with the TemplateInstance
attribute set to Single, use the control's ID as the field
name. This makes it possible to refer to controls inside templates
by name instead of by using FindControl.
Modified: trunk/mcs/class/System.Web/System.Web.Compilation/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.Compilation/ChangeLog 2007-08-29
12:19:31 UTC (rev 84995)
+++ trunk/mcs/class/System.Web/System.Web.Compilation/ChangeLog 2007-08-29
12:37:35 UTC (rev 84996)
@@ -1,3 +1,13 @@
+2007-08-29 Marek Habersack <[EMAIL PROTECTED]>
+
+ * TemplateControlCompiler.cs: mark fields corresponding to the
+ controls as global references.
+ When control tree is constructed and the parent of the current
+ builder is a TemplateBuilder marked with the TemplateInstance
+ attribute set to Single, use the control's ID as the field
+ name. This makes it possible to refer to controls inside templates
+ by name instead of by using FindControl.
+
2007-08-23 Marek Habersack <[EMAIL PROTECTED]>
* AppCodeCompiler.cs: use HttpApplication.BinDirectoryAssemblies
Modified:
trunk/mcs/class/System.Web/System.Web.Compilation/TemplateControlCompiler.cs
===================================================================
---
trunk/mcs/class/System.Web/System.Web.Compilation/TemplateControlCompiler.cs
2007-08-29 12:19:31 UTC (rev 84995)
+++
trunk/mcs/class/System.Web/System.Web.Compilation/TemplateControlCompiler.cs
2007-08-29 12:37:35 UTC (rev 84996)
@@ -81,13 +81,14 @@
}
void CreateField (ControlBuilder builder, bool check)
- {
+ {
if (builder == null || builder.ID == null ||
builder.ControlType == null)
return;
#if NET_2_0
if (partialNameOverride [builder.ID] != null)
return;
#endif
+
MemberAttributes ma = MemberAttributes.Family;
currentLocation = builder.location;
if (check && CheckBaseFieldOrProperty (builder.ID,
builder.ControlType, ref ma))
@@ -97,6 +98,8 @@
field = new CodeMemberField
(builder.ControlType.FullName, builder.ID);
field.Attributes = ma;
#if NET_2_0
+ field.Type.Options |=
CodeTypeReferenceOptions.GlobalReference;
+
if (partialClass != null)
partialClass.Members.Add (field);
else
@@ -1247,10 +1250,16 @@
{
EnsureID (builder);
bool isTemplate = (typeof
(TemplateBuilder).IsAssignableFrom (builder.GetType ()));
+
if (!isTemplate && !inTemplate) {
CreateField (builder, true);
} else if (!isTemplate) {
- builder.ID = builder.GetNextID (null);
+#if NET_2_0
+ TemplateBuilder pb = builder.parentBuilder as
TemplateBuilder;
+ if (pb == null || pb.TemplateInstance !=
TemplateInstance.Single)
+#endif
+ builder.ID = builder.GetNextID (null);
+
CreateField (builder, false);
}
@@ -1263,7 +1272,6 @@
StringBuilder sb = new StringBuilder ();
foreach (object b in builder.Children) {
-
if (b is string) {
sb.Append ((string) b);
continue;
Modified: trunk/mcs/class/System.Web/System.Web.UI/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI/ChangeLog 2007-08-29 12:19:31 UTC
(rev 84995)
+++ trunk/mcs/class/System.Web/System.Web.UI/ChangeLog 2007-08-29 12:37:35 UTC
(rev 84996)
@@ -1,3 +1,9 @@
+2007-08-29 Marek Habersack <[EMAIL PROTECTED]>
+
+ * TemplateBuilder.cs: check for and store for later use the
+ TemplateContainerAttribute. Added a nullable property
+ TemplateInstance to return the value of the attribute.
+
2007-08-29 Vladimir Krasnov <[EMAIL PROTECTED]>
* Control.cs: optimized performance in InitControlsCache()
Modified: trunk/mcs/class/System.Web/System.Web.UI/TemplateBuilder.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI/TemplateBuilder.cs 2007-08-29
12:19:31 UTC (rev 84995)
+++ trunk/mcs/class/System.Web/System.Web.UI/TemplateBuilder.cs 2007-08-29
12:37:35 UTC (rev 84996)
@@ -44,6 +44,7 @@
string text;
TemplateContainerAttribute containerAttribute;
#if NET_2_0
+ TemplateInstanceAttribute instanceAttribute;
ArrayList bindings;
#endif
@@ -53,10 +54,15 @@
internal TemplateBuilder (ICustomAttributeProvider prov)
{
- object[] ats = prov.GetCustomAttributes
(typeof(TemplateContainerAttribute), true);
- if (ats.Length > 0) {
+ object[] ats = prov.GetCustomAttributes (typeof
(TemplateContainerAttribute), true);
+ if (ats.Length > 0)
containerAttribute =
(TemplateContainerAttribute) ats [0];
- }
+
+#if NET_2_0
+ ats = prov.GetCustomAttributes (typeof
(TemplateInstanceAttribute), true);
+ if (ats.Length > 0)
+ instanceAttribute = (TemplateInstanceAttribute)
ats [0];
+#endif
}
public virtual string Text {
@@ -69,6 +75,10 @@
}
#if NET_2_0
+ internal TemplateInstance? TemplateInstance {
+ get { return instanceAttribute != null ?
instanceAttribute.Instances : (TemplateInstance?)null; }
+ }
+
internal BindingDirection BindingDirection {
get { return containerAttribute != null ?
containerAttribute.BindingDirection : BindingDirection.TwoWay; }
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches