+2005-01-10 Lluis Sanchez Gual <lluis@novell.com>
+
+ * TemplateBuilder.cs: Added a special constructor that takes an
+ attribute provider as parameter. The container type for the template
+ may be defined in a TemplateContainerAttribute.
+ * ControlBuilder.cs: Create the TemplateBuilder using that special
+ constructor.
+ * TemplateContainerAttribute.cs: Added 2.0 property and ctor.
+
2004-12-20 Lluis Sanchez Gual <lluis@novell.com>
* IStyleSheet.cs: Added missing "using".
if (typeof (ICollection).IsAssignableFrom (propType)) {
builder = new CollectionBuilder ();
} else if (typeof (ITemplate).IsAssignableFrom (propType)) {
- builder = new TemplateBuilder ();
+ builder = new TemplateBuilder (prop);
} else {
builder = CreateBuilderFromType (parser, parentBuilder, propType, prop.Name,
null, atts, line, fileName);
using System;
using System.Collections;
+using System.Reflection;
namespace System.Web.UI
{
public class TemplateBuilder : ControlBuilder, ITemplate
{
string text;
+ TemplateContainerAttribute containerAttribute;
public TemplateBuilder ()
{
}
+ internal TemplateBuilder (ICustomAttributeProvider prov)
+ {
+ object[] ats = prov.GetCustomAttributes (typeof(TemplateContainerAttribute), true);
+ if (ats.Length > 0) {
+ containerAttribute = (TemplateContainerAttribute) ats [0];
+ }
+ }
+
public virtual string Text {
get { return text; }
set { text = value; }
}
+
+ public Type ContainerType {
+ get { return containerAttribute != null ? containerAttribute.ContainerType : null; }
+ }
public override void Init (TemplateParser parser,
ControlBuilder parentBuilder,
//
using System;
+using System.ComponentModel;
namespace System.Web.UI {
{
Type containerType;
+#if NET_2_0
+ BindingDirection direction;
+
+ public TemplateContainerAttribute (Type containerType, BindingDirection direction)
+ {
+ this.containerType = containerType;
+ this.direction = direction;
+ }
+
+ public BindingDirection BindingDirection {
+ get { return direction; }
+ }
+#endif
+
public TemplateContainerAttribute (Type containerType)
{
this.containerType = containerType;