public override void Make(IConfigurationType config, IExpressionsManager manager) { if (null == config) { throw new ArgumentNullException("config"); } if (null == manager) { throw new ArgumentNullException("manager"); } IConfigurationElement tokenElement = config as IConfigurationElement; if (null == tokenElement) { throw new ArgumentException("config is not an IConfigurationElement"); } if (!tokenElement.Elements.ContainsKey("source")) { throw new ConfigurationException("Bad views token configuration: 'source' element not found"); } IConfigurationElement sourceElement = tokenElement.GetElementReference("source"); if (!sourceElement.Attributes.ContainsKey("parameter")) { throw new ConfigurationException("Bad views token configuration: 'source' element has no 'parameter' attribute"); } this.ParameterName = sourceElement.GetAttributeReference("parameter").Value.ToString(); }
public static void ToConfiguration(this IToken token, IConfigurationElement config) { if (!config.Attributes.ContainsKey("type")) config.AddAttribute("type").Value = token.Key; else if ((string)config.GetAttributeReference("type").Value != token.Key) config.GetAttributeReference("type").Value = token.Key; IExpression expression = token as IExpression; if (null != expression) { IConfigurationElement operandsElement = config.AddElement("operands"); int index = 0; foreach (IToken operand in expression.Operands.Where(o => null != o)) { IConfigurationElement operandElement = operandsElement.AddElement(index.ToString()); operand.ToConfiguration(operandElement); index++; } } else { IBasicToken basicToken = token as IBasicToken; if (null != basicToken) { IConfigurationElement sourceElement = config.AddElement("source"); if (null != basicToken.Source) { if (basicToken.Source is Control) sourceElement.AddAttribute("id").Value = ((Control)basicToken.Source).ID; else sourceElement.AddAttribute("id").Value = basicToken.Source; if (!String.IsNullOrEmpty(basicToken.Member)) sourceElement.AddAttribute("member").Value = basicToken.Member; } else if (null != basicToken.Value) sourceElement.AddAttribute("value").Value = basicToken.Source; } else { System.Reflection.MethodInfo concreteMethod = token.GetType().GetMethod("ToConfiguration", new Type[] { typeof(IConfigurationElement) }); if (null != concreteMethod) concreteMethod.Invoke(token, new object[] { config }); } } }
public override void Make(IConfigurationType config, IExpressionsManager manager) { if (null == config) { throw new ArgumentNullException("config"); } IConfigurationElement element = config as IConfigurationElement; if (null == element) { throw new ArgumentException("config must be an IConfigurationElement"); } if (element.Elements.ContainsKey("source")) { IConfigurationElement sourceElement = element.GetElementReference("source"); if (sourceElement.Attributes.ContainsKey("id")) { if (null == manager) { throw new ArgumentNullException("manager"); } this.Source = manager.FindControl(sourceElement.GetAttributeReference("id").Value.ToString()); if (null == this.Source) { this.Source = sourceElement.GetAttributeReference("id").Value; } if (sourceElement.Attributes.ContainsKey("member")) { this.Member = sourceElement.GetAttributeReference("member").Value.ToString(); } } else { if (sourceElement.Attributes.ContainsKey("value")) { this.Source = sourceElement.GetAttributeReference("value").Value; } } } }
protected override void Make(IConfigurationElement sourceElement, IExpressionsManager manager) { if (null == sourceElement) throw new ArgumentNullException("sourceElement"); if (null == manager) throw new ArgumentNullException("manager"); if (!sourceElement.Attributes.ContainsKey("table")) throw new ConfigurationException("Bad views field token configuration: 'source' element has no 'table' attribute"); this.TableName = sourceElement.GetAttributeReference("table").Value.ToString(); base.Make(sourceElement, manager); }
private TransitPoint CreateTransitPoint(WebPartManager manager, IConfigurationElement element, IExpressionsManager expressionsManager) { bool valid = false; TransitPoint transitPoint = new TransitPoint(); if (element.Attributes.ContainsKey("id")) { valid = true; transitPoint.Chronicler = (ReflectionServices.FindControlEx(element.GetAttributeReference("id").Value.ToString(), manager) as IChronicler); } if (element.Attributes.ContainsKey("member")) { transitPoint.Member = element.GetAttributeReference("member").Value.ToString(); } if (element.Attributes.ContainsKey("value")) { valid = true; transitPoint.Value = element.GetAttributeReference("value").Value; } if (element.Elements.ContainsKey("expression")) { valid = true; IConfigurationElement expressionElement = element.GetElementReference("expression"); IExpression expression = expressionsManager.Token(expressionElement.GetAttributeReference("type").Value.ToString()) as IExpression; if (null == expression) { throw new InvalidOperationException("Token is not an IExpression"); } expression.Make(expressionElement, expressionsManager); transitPoint.Expression = expression; } if (!valid) { transitPoint = null; } return(transitPoint); }
public IConfigurationElementAttribute GetAttributeReference(string element, string attribute) { if (string.IsNullOrEmpty(element)) { throw new ArgumentNullException(element); } if (string.IsNullOrEmpty(attribute)) { throw new ArgumentNullException(attribute); } IConfigurationElement elementRef = this.GetElementReference(element); return(elementRef.GetAttributeReference(attribute)); }
public static IExpression Expression(this IExpressionsManager manager, XElement element) { Configuration config = new Configuration(); IConfigurationElement configElement = config.AddSection("expression extensions").AddElement("expression"); configElement.ReadXml(element.CreateReader()); IExpression expression = manager.Token(configElement.GetAttributeReference("type").Value.ToString()) as IExpression; if (null != expression) { expression.Make(configElement, manager); } return(expression); }
protected virtual void LoadCellProperties(TableCell cell, IConfigurationElement configCell) { if (ControlFactory.Instance.KnownTypes.ContainsKey("TableCell")) { ControlFactory.ControlDescriptor descriptor = ControlFactory.Instance.KnownTypes["TableCell"]; foreach (string name in descriptor.EditableProperties.Keys) { if (configCell.Attributes.ContainsKey(name)) { ReflectionServices.SetValue(cell, name, configCell.GetAttributeReference(name).Value); } } } }
protected virtual void Make(IConfigurationElement sourceElement, IExpressionsManager manager) { if (null == sourceElement) { throw new ArgumentNullException("sourceElement"); } if (null == manager) { throw new ArgumentNullException("manager"); } if (!sourceElement.Attributes.ContainsKey("field")) { throw new ConfigurationException("Bad views field token configuration: 'source' element has no 'field' attribute"); } this.FieldName = sourceElement.GetAttributeReference("field").Value.ToString(); }
protected override void Make(IConfigurationElement sourceElement, IExpressionsManager manager) { if (null == sourceElement) { throw new ArgumentNullException("sourceElement"); } if (null == manager) { throw new ArgumentNullException("manager"); } if (!sourceElement.Attributes.ContainsKey("view")) { throw new ConfigurationException("Bad view as token configuration: 'source' element has no 'view' attribute"); } this.ViewName = sourceElement.GetAttributeReference("view").Value.ToString(); base.Make(sourceElement, manager); }
public virtual void Create(Control container, IConfigurationType config, ITemplatable templatable, IBinder binder, ITemplatingItem item, int itemIndex, WebPartManager manager, bool keepTable) { if (null == container) { throw new ArgumentNullException("container"); } if (null == config) { throw new ArgumentNullException("config"); } if (!(config is IConfigurationSection)) { throw new ArgumentException("config must be an IConfigurationSection"); } Table containerTable; if (container is Table) { containerTable = (container as Table); } else { containerTable = new Table(); containerTable.ID = container.ID + "grouping"; } IConfigurationElement element = (config as IConfigurationSection).GetElementReference("grouping"); Table table; if (keepTable) { table = containerTable; } else { TableRow tr = new TableRow(); TableCell tc = new TableCell(); table = new Table(); tr.ID = "groupingTable" + itemIndex.ToString() + "row"; tc.ID = "groupingTable" + itemIndex.ToString() + "cell"; table.ID = "groupingTable" + itemIndex.ToString(); tc.Controls.Add(table); tr.Cells.Add(tc); containerTable.Rows.Add(tr); if (element.Attributes.ContainsKey("span")) { int columnSpan = 1; int.TryParse(element.GetAttributeReference("span").Value.ToString(), out columnSpan); tc.ColumnSpan = columnSpan; } if (element.Attributes.ContainsKey("rowspan")) { int rowSpan = 1; int.TryParse(element.GetAttributeReference("rowspan").Value.ToString(), out rowSpan); tc.RowSpan = rowSpan; } } table.ApplyStyle(templatable.GroupingStyle); foreach (IConfigurationElement rowElement in element.Elements.Values) { this.DisplayItem(table, rowElement, "grouping" + itemIndex.ToString(), binder, item, templatable.GroupRowStyle, templatable.InvalidItemStyle, manager); } if (!(container is Table)) { container.Controls.Add(containerTable); } }
public static void ToConfiguration(this IToken token, IConfigurationElement config) { if (!config.Attributes.ContainsKey("type")) { config.AddAttribute("type").Value = token.Key; } else if ((string)config.GetAttributeReference("type").Value != token.Key) { config.GetAttributeReference("type").Value = token.Key; } IExpression expression = token as IExpression; if (null != expression) { IConfigurationElement operandsElement = config.AddElement("operands"); int index = 0; foreach (IToken operand in expression.Operands.Where(o => null != o)) { IConfigurationElement operandElement = operandsElement.AddElement(index.ToString()); operand.ToConfiguration(operandElement); index++; } } else { IBasicToken basicToken = token as IBasicToken; if (null != basicToken) { IConfigurationElement sourceElement = config.AddElement("source"); if (null != basicToken.Source) { if (basicToken.Source is Control) { sourceElement.AddAttribute("id").Value = ((Control)basicToken.Source).ID; } else { sourceElement.AddAttribute("id").Value = basicToken.Source; } if (!String.IsNullOrEmpty(basicToken.Member)) { sourceElement.AddAttribute("member").Value = basicToken.Member; } } else if (null != basicToken.Value) { sourceElement.AddAttribute("value").Value = basicToken.Source; } } else { System.Reflection.MethodInfo concreteMethod = token.GetType().GetMethod("ToConfiguration", new Type[] { typeof(IConfigurationElement) }); if (null != concreteMethod) { concreteMethod.Invoke(token, new object[] { config }); } } } }
public Control CreateControl(IConfigurationElement controlElement, string index, IBinder binder, ITemplatingItem item, WebControl container, TableItemStyle invalidStyle, Dictionary<string, Control> registry, WebPartManager manager) { if (null == this._monitor) { throw new ApplicationException("Monitor not set"); } Control result; if (!controlElement.Attributes.ContainsKey("proxy") && !controlElement.Attributes.ContainsKey("type")) { result = null; } else { Control cellControl = null; string cellControlName = null; if (controlElement.Attributes.ContainsKey("proxy")) { object proxyIDValue = controlElement.GetAttributeReference("proxy").Value; string proxyID = null; if (null != proxyIDValue) { proxyID = proxyIDValue.ToString(); } if (string.IsNullOrEmpty(proxyID)) { result = null; return result; } Control proxy = ReflectionServices.FindControlEx(proxyID, manager); if (null == proxy) { this._monitor.Register(this, this._monitor.NewEventInstance("create proxy error", null, new ApplicationException("can't find proxy " + proxyID), EVENT_TYPE.Error)); } string proxyMember = null; if (!controlElement.Attributes.ContainsKey("proxyMember")) { this._monitor.Register(this, this._monitor.NewEventInstance("create proxy error", null, new ApplicationException("proxyMember not found for proxy " + proxyID), EVENT_TYPE.Error)); } else { proxyMember = controlElement.GetAttributeReference("proxyMember").Value.ToString(); } try { cellControl = (ReflectionServices.ExtractValue(proxy, proxyMember) as Control); cellControlName = proxy + "." + proxyMember; } catch (Exception ex) { this._monitor.Register(this, this._monitor.NewEventInstance("create proxy error", null, ex, EVENT_TYPE.Error)); } if (cellControl == null && null != proxy) { this._monitor.Register(this, this._monitor.NewEventInstance("create proxy error", null, new ApplicationException(string.Format("member {0} of proxy type {1} is not a Control", proxyMember, proxy.GetType().FullName)), EVENT_TYPE.Error)); } } else { Control scope = container; if (container is TableCell) { scope = container.Parent.Parent; } try { cellControl = this.CreateControl(controlElement.GetAttributeReference("type").Value.ToString(), new bool?(item == null || item.IsReadOnly), scope); cellControlName = controlElement.GetAttributeReference("type").Value.ToString(); } catch (Exception ex) { this._monitor.Register(this, this._monitor.NewEventInstance("create control error", null, ex, EVENT_TYPE.Error)); } } if (null == cellControl) { result = null; } else { string type = null; if (controlElement.Attributes.ContainsKey("type")) { type = controlElement.GetAttributeReference("type").Value.ToString(); if (cellControl is IButtonControl) { IButtonControl btn = cellControl as IButtonControl; if (("Commander" == type || "LinkCommander" == type) && !controlElement.Attributes.ContainsKey("command")) { this._monitor.Register(this, this._monitor.NewEventInstance(string.Format("create {0} error", type), null, new ApplicationException("command not found"), EVENT_TYPE.Error)); } else { if (controlElement.Attributes.ContainsKey("command")) { btn.CommandName = controlElement.GetAttributeReference("command").Value.ToString(); } } btn.CommandArgument = index; } if (cellControl is StatelessDropDownList) ((StatelessDropDownList)cellControl).CommandArgument = index; } if (null != registry) { registry.Add(controlElement.ConfigKey, cellControl); } var properties = controlElement.Elements.Values; foreach (IConfigurationElement controlPropertyElement in properties) { if (!controlPropertyElement.Attributes.ContainsKey("for") || !("cell" == controlPropertyElement.GetAttributeReference("for").Value.ToString())) { string propertyName = null; if (!controlPropertyElement.Attributes.ContainsKey("member")) { this._monitor.Register(this, this._monitor.NewEventInstance(string.Format("'{0}' property set error", cellControlName), null, new ApplicationException(string.Format("member not found for '{0}'", controlPropertyElement.ConfigKey)), EVENT_TYPE.Error)); } else { propertyName = controlPropertyElement.GetAttributeReference("member").Value.ToString(); } IExpression expression = null; LWAS.Extensible.Interfaces.IResult expressionResult = null; if (controlPropertyElement.Elements.ContainsKey("expression")) { IConfigurationElement expressionElement = controlPropertyElement.GetElementReference("expression"); Manager sysmanager = manager as Manager; if (null != sysmanager && null != sysmanager.ExpressionsManager && expressionElement.Attributes.ContainsKey("type")) { expression = sysmanager.ExpressionsManager.Token(expressionElement.GetAttributeReference("type").Value.ToString()) as IExpression; if (null != expression) { try { expression.Make(expressionElement, sysmanager.ExpressionsManager); expressionResult = expression.Evaluate(); } catch (ArgumentException ax) { } } } } object defaultValue = null; if (!string.IsNullOrEmpty(propertyName) && controlPropertyElement.Attributes.ContainsKey("value")) { defaultValue = controlPropertyElement.GetAttributeReference("value").Value; if (null == expression || null == binder) { try { if (string.IsNullOrEmpty(cellControlName) || propertyName != this.KnownTypes[cellControlName].ReadOnlyProperty || (propertyName == this.KnownTypes[cellControlName].ReadOnlyProperty && defaultValue != null && !string.IsNullOrEmpty(defaultValue.ToString()))) { if (propertyName == "Watermark") { if (null != defaultValue && !String.IsNullOrEmpty(defaultValue.ToString())) ReflectionServices.SetValue(cellControl, propertyName, defaultValue); } else ReflectionServices.SetValue(cellControl, propertyName, defaultValue); } } catch (Exception ex) { this._monitor.Register(this, this._monitor.NewEventInstance(string.Format("'{0}'.'{1}'='{2}' error", cellControlName, propertyName, controlPropertyElement.GetAttributeReference("value").Value), null, ex, EVENT_TYPE.Error)); } } else { IBindingItem bindingItem = binder.NewBindingItemInstance(); bindingItem.Source = new Dictionary<string, object>() { { "0", defaultValue} }; bindingItem.SourceProperty = "0"; bindingItem.Target = cellControl; bindingItem.TargetProperty = propertyName; bindingItem.Expression = expression; bindingItem.ExpressionEvaluationResult = expressionResult; binder.BindingItems.Add(bindingItem); } } if (controlPropertyElement.Attributes.ContainsKey("isList") && (bool)controlPropertyElement.GetAttributeReference("isList").Value) { object list = null; try { list = ReflectionServices.ExtractValue(cellControl, propertyName); if (null == list) throw new InvalidOperationException(string.Format("Member '{0}' is empty", propertyName)); if (!(list is ListItemCollection) && !(list is IDictionary<string, object>)) throw new InvalidOperationException(String.Format("Unsupported list type '{0}'", list.GetType().Name)); } catch (Exception ex) { this._monitor.Register(this, this._monitor.NewEventInstance("failed to retrive the list", null, ex, EVENT_TYPE.Error)); } if (null != list) { if (controlPropertyElement.Attributes.ContainsKey("hasEmpty") && (bool)controlPropertyElement.GetAttributeReference("hasEmpty").Value) { if (list is ListItemCollection) ((ListItemCollection)list).Add(""); else if (list is Dictionary<string, object>) ((Dictionary<string, object>)list).Add("", ""); } foreach (IConfigurationElement listItemElement in controlPropertyElement.Elements.Values) { string value = null; string text = null; string pull = null; if (listItemElement.Attributes.ContainsKey("value") && null != listItemElement.GetAttributeReference("value").Value) value = listItemElement.GetAttributeReference("value").Value.ToString(); if (listItemElement.Attributes.ContainsKey("text") && null != listItemElement.GetAttributeReference("text").Value) text = listItemElement.GetAttributeReference("text").Value.ToString(); if (listItemElement.Attributes.ContainsKey("pull") && null != listItemElement.GetAttributeReference("pull").Value) pull = listItemElement.GetAttributeReference("pull").Value.ToString(); if (list is ListItemCollection) { ListItem li = new ListItem(text, value); ((ListItemCollection)list).Add(li); if (null != binder && !String.IsNullOrEmpty(pull)) { IBindingItem bindingItem = binder.NewBindingItemInstance(); bindingItem.Source = item.Data; bindingItem.SourceProperty = pull; bindingItem.Target = li; bindingItem.TargetProperty = "Text"; bindingItem.Expression = expression; binder.BindingItems.Add(bindingItem); } } else if (list is Dictionary<string, object>) { ((Dictionary<string, object>)list).Add(value, text); if (null != binder && !String.IsNullOrEmpty(pull)) { IBindingItem bindingItem = binder.NewBindingItemInstance(); bindingItem.Source = item.Data; bindingItem.SourceProperty = pull; bindingItem.Target = list; bindingItem.TargetProperty = value; bindingItem.Expression = expression; binder.BindingItems.Add(bindingItem); } } } } } if (controlPropertyElement.Attributes.ContainsKey("property")) { if (container.Page != null && null != binder) { IBindingItem bindingItem = binder.NewBindingItemInstance(); bindingItem.Source = WebPartManager.GetCurrentWebPartManager(container.Page); bindingItem.SourceProperty = "WebParts." + controlPropertyElement.GetAttributeReference("property").Value.ToString(); bindingItem.Target = cellControl; bindingItem.TargetProperty = propertyName; if (string.IsNullOrEmpty(cellControlName) || propertyName != this.KnownTypes[cellControlName].ReadOnlyProperty) bindingItem.DefaultValue = defaultValue; bindingItem.Expression = expression; binder.BindingItems.Add(bindingItem); } } if (controlPropertyElement.Attributes.ContainsKey("pull")) { string pull = controlPropertyElement.GetAttributeReference("pull").Value.ToString(); if (binder != null && null != item) { IBindingItem bindingItem = binder.NewBindingItemInstance(); bindingItem.Source = item.Data; bindingItem.SourceProperty = pull; bindingItem.Target = cellControl; bindingItem.TargetProperty = propertyName; if (string.IsNullOrEmpty(cellControlName) || propertyName != this.KnownTypes[cellControlName].ReadOnlyProperty) bindingItem.DefaultValue = defaultValue; bindingItem.Expression = expression; binder.BindingItems.Add(bindingItem); if (item.InvalidMember == bindingItem.SourceProperty) container.ApplyStyle(invalidStyle); } if (this.IsDesignEnabled && propertyName == this.KnownTypes[cellControlName].WatermarkProperty) { // StyleTextBox has its own Watermark feature if (typeof(StyledTextBox).IsInstanceOfType(cellControl)) { ReflectionServices.SetValue(cellControl, "Watermark", pull); } else container.Attributes.Add("watermark", pull); } } } } result = cellControl; } } return result; }
private TransitPoint CreateTransitPoint(WebPartManager manager, IConfigurationElement element, IExpressionsManager expressionsManager) { bool valid = false; TransitPoint transitPoint = new TransitPoint(); if (element.Attributes.ContainsKey("id")) { valid = true; transitPoint.Chronicler = (ReflectionServices.FindControlEx(element.GetAttributeReference("id").Value.ToString(), manager) as IChronicler); } if (element.Attributes.ContainsKey("member")) { transitPoint.Member = element.GetAttributeReference("member").Value.ToString(); } if (element.Attributes.ContainsKey("value")) { valid = true; transitPoint.Value = element.GetAttributeReference("value").Value; } if (element.Elements.ContainsKey("expression")) { valid = true; IConfigurationElement expressionElement = element.GetElementReference("expression"); IExpression expression = expressionsManager.Token(expressionElement.GetAttributeReference("type").Value.ToString()) as IExpression; if (null == expression) throw new InvalidOperationException("Token is not an IExpression"); expression.Make(expressionElement, expressionsManager); transitPoint.Expression = expression; } if (!valid) transitPoint = null; return transitPoint; }
protected virtual void LoadCellProperties(TableCell cell, IConfigurationElement configCell) { if (ControlFactory.Instance.KnownTypes.ContainsKey("TableCell")) { ControlFactory.ControlDescriptor descriptor = ControlFactory.Instance.KnownTypes["TableCell"]; foreach (string name in descriptor.EditableProperties.Keys) { if (configCell.Attributes.ContainsKey(name)) { ReflectionServices.SetValue(cell, name, configCell.GetAttributeReference(name).Value); } } } }
public Control CreateControl(IConfigurationElement controlElement, string index, IBinder binder, ITemplatingItem item, WebControl container, TableItemStyle invalidStyle, Dictionary <string, Control> registry, WebPartManager manager) { if (null == this._monitor) { throw new ApplicationException("Monitor not set"); } Control result; if (!controlElement.Attributes.ContainsKey("proxy") && !controlElement.Attributes.ContainsKey("type")) { result = null; } else { Control cellControl = null; string cellControlName = null; if (controlElement.Attributes.ContainsKey("proxy")) { object proxyIDValue = controlElement.GetAttributeReference("proxy").Value; string proxyID = null; if (null != proxyIDValue) { proxyID = proxyIDValue.ToString(); } if (string.IsNullOrEmpty(proxyID)) { result = null; return(result); } Control proxy = ReflectionServices.FindControlEx(proxyID, manager); if (null == proxy) { this._monitor.Register(this, this._monitor.NewEventInstance("create proxy error", null, new ApplicationException("can't find proxy " + proxyID), EVENT_TYPE.Error)); } string proxyMember = null; if (!controlElement.Attributes.ContainsKey("proxyMember")) { this._monitor.Register(this, this._monitor.NewEventInstance("create proxy error", null, new ApplicationException("proxyMember not found for proxy " + proxyID), EVENT_TYPE.Error)); } else { proxyMember = controlElement.GetAttributeReference("proxyMember").Value.ToString(); } try { cellControl = (ReflectionServices.ExtractValue(proxy, proxyMember) as Control); cellControlName = proxy + "." + proxyMember; } catch (Exception ex) { this._monitor.Register(this, this._monitor.NewEventInstance("create proxy error", null, ex, EVENT_TYPE.Error)); } if (cellControl == null && null != proxy) { this._monitor.Register(this, this._monitor.NewEventInstance("create proxy error", null, new ApplicationException(string.Format("member {0} of proxy type {1} is not a Control", proxyMember, proxy.GetType().FullName)), EVENT_TYPE.Error)); } } else { Control scope = container; if (container is TableCell) { scope = container.Parent.Parent; } try { cellControl = this.CreateControl(controlElement.GetAttributeReference("type").Value.ToString(), new bool?(item == null || item.IsReadOnly), scope); cellControlName = controlElement.GetAttributeReference("type").Value.ToString(); } catch (Exception ex) { this._monitor.Register(this, this._monitor.NewEventInstance("create control error", null, ex, EVENT_TYPE.Error)); } } if (null == cellControl) { result = null; } else { string type = null; if (controlElement.Attributes.ContainsKey("type")) { type = controlElement.GetAttributeReference("type").Value.ToString(); if (cellControl is IButtonControl) { IButtonControl btn = cellControl as IButtonControl; if (("Commander" == type || "LinkCommander" == type) && !controlElement.Attributes.ContainsKey("command")) { this._monitor.Register(this, this._monitor.NewEventInstance(string.Format("create {0} error", type), null, new ApplicationException("command not found"), EVENT_TYPE.Error)); } else { if (controlElement.Attributes.ContainsKey("command")) { btn.CommandName = controlElement.GetAttributeReference("command").Value.ToString(); } } btn.CommandArgument = index; } if (cellControl is StatelessDropDownList) { ((StatelessDropDownList)cellControl).CommandArgument = index; } } if (null != registry) { registry.Add(controlElement.ConfigKey, cellControl); } var properties = controlElement.Elements.Values; foreach (IConfigurationElement controlPropertyElement in properties) { if (!controlPropertyElement.Attributes.ContainsKey("for") || !("cell" == controlPropertyElement.GetAttributeReference("for").Value.ToString())) { string propertyName = null; if (!controlPropertyElement.Attributes.ContainsKey("member")) { this._monitor.Register(this, this._monitor.NewEventInstance(string.Format("'{0}' property set error", cellControlName), null, new ApplicationException(string.Format("member not found for '{0}'", controlPropertyElement.ConfigKey)), EVENT_TYPE.Error)); } else { propertyName = controlPropertyElement.GetAttributeReference("member").Value.ToString(); } IExpression expression = null; LWAS.Extensible.Interfaces.IResult expressionResult = null; if (controlPropertyElement.Elements.ContainsKey("expression")) { IConfigurationElement expressionElement = controlPropertyElement.GetElementReference("expression"); Manager sysmanager = manager as Manager; if (null != sysmanager && null != sysmanager.ExpressionsManager && expressionElement.Attributes.ContainsKey("type")) { expression = sysmanager.ExpressionsManager.Token(expressionElement.GetAttributeReference("type").Value.ToString()) as IExpression; if (null != expression) { try { expression.Make(expressionElement, sysmanager.ExpressionsManager); expressionResult = expression.Evaluate(); } catch (ArgumentException ax) { } } } } object defaultValue = null; if (!string.IsNullOrEmpty(propertyName) && controlPropertyElement.Attributes.ContainsKey("value")) { defaultValue = controlPropertyElement.GetAttributeReference("value").Value; if (null == expression || null == binder) { try { if (string.IsNullOrEmpty(cellControlName) || propertyName != this.KnownTypes[cellControlName].ReadOnlyProperty || (propertyName == this.KnownTypes[cellControlName].ReadOnlyProperty && defaultValue != null && !string.IsNullOrEmpty(defaultValue.ToString()))) { if (propertyName == "Watermark") { if (null != defaultValue && !String.IsNullOrEmpty(defaultValue.ToString())) { ReflectionServices.SetValue(cellControl, propertyName, defaultValue); } } else { ReflectionServices.SetValue(cellControl, propertyName, defaultValue); } } } catch (Exception ex) { this._monitor.Register(this, this._monitor.NewEventInstance(string.Format("'{0}'.'{1}'='{2}' error", cellControlName, propertyName, controlPropertyElement.GetAttributeReference("value").Value), null, ex, EVENT_TYPE.Error)); } } else { IBindingItem bindingItem = binder.NewBindingItemInstance(); bindingItem.Source = new Dictionary <string, object>() { { "0", defaultValue } }; bindingItem.SourceProperty = "0"; bindingItem.Target = cellControl; bindingItem.TargetProperty = propertyName; bindingItem.Expression = expression; bindingItem.ExpressionEvaluationResult = expressionResult; binder.BindingItems.Add(bindingItem); } } if (controlPropertyElement.Attributes.ContainsKey("isList") && (bool)controlPropertyElement.GetAttributeReference("isList").Value) { object list = null; try { list = ReflectionServices.ExtractValue(cellControl, propertyName); if (null == list) { throw new InvalidOperationException(string.Format("Member '{0}' is empty", propertyName)); } if (!(list is ListItemCollection) && !(list is IDictionary <string, object>)) { throw new InvalidOperationException(String.Format("Unsupported list type '{0}'", list.GetType().Name)); } } catch (Exception ex) { this._monitor.Register(this, this._monitor.NewEventInstance("failed to retrive the list", null, ex, EVENT_TYPE.Error)); } if (null != list) { if (controlPropertyElement.Attributes.ContainsKey("hasEmpty") && (bool)controlPropertyElement.GetAttributeReference("hasEmpty").Value) { if (list is ListItemCollection) { ((ListItemCollection)list).Add(""); } else if (list is Dictionary <string, object> ) { ((Dictionary <string, object>)list).Add("", ""); } } foreach (IConfigurationElement listItemElement in controlPropertyElement.Elements.Values) { string value = null; string text = null; string pull = null; if (listItemElement.Attributes.ContainsKey("value") && null != listItemElement.GetAttributeReference("value").Value) { value = listItemElement.GetAttributeReference("value").Value.ToString(); } if (listItemElement.Attributes.ContainsKey("text") && null != listItemElement.GetAttributeReference("text").Value) { text = listItemElement.GetAttributeReference("text").Value.ToString(); } if (listItemElement.Attributes.ContainsKey("pull") && null != listItemElement.GetAttributeReference("pull").Value) { pull = listItemElement.GetAttributeReference("pull").Value.ToString(); } if (list is ListItemCollection) { ListItem li = new ListItem(text, value); ((ListItemCollection)list).Add(li); if (null != binder && !String.IsNullOrEmpty(pull)) { IBindingItem bindingItem = binder.NewBindingItemInstance(); bindingItem.Source = item.Data; bindingItem.SourceProperty = pull; bindingItem.Target = li; bindingItem.TargetProperty = "Text"; bindingItem.Expression = expression; binder.BindingItems.Add(bindingItem); } } else if (list is Dictionary <string, object> ) { ((Dictionary <string, object>)list).Add(value, text); if (null != binder && !String.IsNullOrEmpty(pull)) { IBindingItem bindingItem = binder.NewBindingItemInstance(); bindingItem.Source = item.Data; bindingItem.SourceProperty = pull; bindingItem.Target = list; bindingItem.TargetProperty = value; bindingItem.Expression = expression; binder.BindingItems.Add(bindingItem); } } } } } if (controlPropertyElement.Attributes.ContainsKey("property")) { if (container.Page != null && null != binder) { IBindingItem bindingItem = binder.NewBindingItemInstance(); bindingItem.Source = WebPartManager.GetCurrentWebPartManager(container.Page); bindingItem.SourceProperty = "WebParts." + controlPropertyElement.GetAttributeReference("property").Value.ToString(); bindingItem.Target = cellControl; bindingItem.TargetProperty = propertyName; if (string.IsNullOrEmpty(cellControlName) || propertyName != this.KnownTypes[cellControlName].ReadOnlyProperty) { bindingItem.DefaultValue = defaultValue; } bindingItem.Expression = expression; binder.BindingItems.Add(bindingItem); } } if (controlPropertyElement.Attributes.ContainsKey("pull")) { string pull = controlPropertyElement.GetAttributeReference("pull").Value.ToString(); if (binder != null && null != item) { IBindingItem bindingItem = binder.NewBindingItemInstance(); bindingItem.Source = item.Data; bindingItem.SourceProperty = pull; bindingItem.Target = cellControl; bindingItem.TargetProperty = propertyName; if (string.IsNullOrEmpty(cellControlName) || propertyName != this.KnownTypes[cellControlName].ReadOnlyProperty) { bindingItem.DefaultValue = defaultValue; } bindingItem.Expression = expression; binder.BindingItems.Add(bindingItem); if (item.InvalidMember == bindingItem.SourceProperty) { container.ApplyStyle(invalidStyle); } } if (this.IsDesignEnabled && propertyName == this.KnownTypes[cellControlName].WatermarkProperty) { // StyleTextBox has its own Watermark feature if (typeof(StyledTextBox).IsInstanceOfType(cellControl)) { ReflectionServices.SetValue(cellControl, "Watermark", pull); } else { container.Attributes.Add("watermark", pull); } } } } } result = cellControl; } } return(result); }
public override IResult Parse(object source) { if (null == source) { throw new ArgumentNullException("source"); } ContainerWebPart webPart = source as ContainerWebPart; if (null == webPart) { throw new ArgumentException("source is not an ContainerWebPart"); } IConfiguration config = webPart.Configuration; if (null == config) { throw new ArgumentException("missing configuration"); } IValidationManager validationManager = webPart.ValidationManager; if (null == validationManager) { throw new ArgumentException("missing validation manager"); } base.Parse(source); if (config.Sections.ContainsKey("Template")) { IConfigurationSection templateConfig = config.GetConfigurationSectionReference("Template"); webPart.TemplateConfig = templateConfig; } else { webPart.TemplateConfig = config.NewConfigurationSectionInstance("Template"); } if (config.Sections.ContainsKey("Validation")) { foreach (IConfigurationElement element in config.Sections["Validation"].Elements.Values) { IValidationTask task = validationManager.NewValidationTaskInstance(); if (element.Attributes.ContainsKey("target")) { task.Target = element.GetAttributeReference("target").Value; } if (element.Attributes.ContainsKey("member")) { task.Member = element.GetAttributeReference("member").Value.ToString(); } foreach (IConfigurationElement handlerElement in element.Elements.Values) { if (handlerElement.Attributes.ContainsKey("handlerKey")) { string handlerKey = handlerElement.GetAttributeReference("handlerKey").Value.ToString(); IValidationHandler handler = validationManager.Handler(handlerKey); if ("expression" == handlerKey) { IExpressionHandler expressionHandler = handler as IExpressionHandler; IEnumerator <IConfigurationElement> enumerator = handlerElement.Elements.Values.GetEnumerator(); if (enumerator.MoveNext()) { IConfigurationElement expressionElement = enumerator.Current; expressionHandler.Expression = (validationManager.ExpressionsManager.Token(expressionElement.GetAttributeReference("type").Value.ToString()) as IExpression); if (null == expressionHandler.Expression) { throw new InvalidOperationException("Token is not an IExpression"); } expressionHandler.Expression.Make(expressionElement, validationManager.ExpressionsManager); } } task.Handlers.Add(handler); } } validationManager.RegisterTask(task); } } if (config.Sections.ContainsKey("Checks")) { foreach (IConfigurationElement element in config.Sections["Checks"].Elements.Values) { if (element.Attributes.ContainsKey("command")) { string command = element.GetAttributeReference("command").Value.ToString(); webPart.Checks.Add(command, new List <Container.CheckDefinition>()); foreach (IConfigurationElement checkElement in element.Elements.Values) { Container.CheckDefinition check = new Container.CheckDefinition(); if (checkElement.Attributes.ContainsKey("error")) { check.Error = checkElement.GetAttributeReference("error").Value.ToString(); } if (checkElement.Attributes.ContainsKey("milestone")) { check.Milestone = checkElement.GetAttributeReference("milestone").Value.ToString(); } IEnumerator <IConfigurationElement> enumerator = checkElement.Elements.Values.GetEnumerator(); if (enumerator.MoveNext()) { IConfigurationElement expressionElement = enumerator.Current; IExpression expression = webPart.ExpressionsManager.Token(expressionElement.GetAttributeReference("type").Value.ToString()) as IExpression; if (null == expression) { throw new InvalidOperationException("Token is not an IExpression"); } expression.Make(expressionElement, webPart.ExpressionsManager); check.Expression = expression; } webPart.Checks[command].Add(check); } } } } return(null); }
private BoundField GetField(IConfigurationElement element) { if (element.Attributes.ContainsKey("type")) { string type = element.Attributes["type"].Value.ToString(); BoundField field; switch (type) { case "Text": { field = new BoundField(); break; } case "Label": { field = new BoundField(); field.ReadOnly = true; break; } case "Date": { field = new DateBoundField(); break; } case "Number": { field = new NumberBoundField(); break; } case "DropDownList": { field = new DropDownListField(); break; } case "CheckBox": case "Check": { field = new CheckBoxField(); break; } case "Hidden": { field = new BoundField(); field.ItemStyle.CssClass = "hidden"; break; } default: { throw new ArgumentException("Unknown grid view field type '" + element.Attributes["type"].Value.ToString() + "'"); } } if (!(field is CheckBoxField)) { field.HtmlEncode = false; } if (element.Attributes.ContainsKey("DataMember")) { field.DataField = element.Attributes["DataMember"].Value.ToString(); } ; if (element.Attributes.ContainsKey("HeaderText")) { field.HeaderText = element.Attributes["HeaderText"].Value.ToString(); } ; if (element.Attributes.ContainsKey("FormatString")) { try { field.DataFormatString = element.Attributes["FormatString"].Value.ToString(); } catch { } } if (field is DropDownListField) { if (element.Attributes.ContainsKey("DataTextField")) { ((DropDownListField)field).DataTextField = element.GetAttributeReference("DataTextField").Value.ToString(); } if (element.Attributes.ContainsKey("DataValueField")) { ((DropDownListField)field).DataValueField = element.GetAttributeReference("DataValueField").Value.ToString(); } } return(field); } return(null); }
public virtual void DisplayItem(Table table, IConfigurationElement element, string index, IBinder binder, ITemplatingItem item, TableItemStyle style, TableItemStyle invalidStyle, Dictionary <string, Control> registry, WebPartManager manager) { string[] span = null; if (element.Attributes.ContainsKey("span") && null != element.GetAttributeReference("span").Value) { span = element.GetAttributeReference("span").Value.ToString().Split(new char[] { ',' }); } string[] rowspan = null; if (element.Attributes.ContainsKey("rowspan") && null != element.GetAttributeReference("rowspan").Value) { rowspan = element.GetAttributeReference("rowspan").Value.ToString().Split(new char[] { ',' }); } TableRow tr = new TableRow(); tr.ID = string.Concat(new string[] { table.ID, "-", element.ConfigKey, "-", index }); tr.Attributes["key"] = element.ConfigKey; tr.ApplyStyle(style); foreach (IConfigurationElementAttribute attribute in element.Attributes.Values) { if ("span" != attribute.ConfigKey && "rowspan" != attribute.ConfigKey) { tr.Style.Add(attribute.ConfigKey, attribute.Value.ToString()); } } table.Rows.Add(tr); int count = 0; foreach (IConfigurationElement controlElement in element.Elements.Values) { TableCell tc = new TableCell(); tc.ID = tr.ID + "-" + controlElement.ConfigKey; tc.Attributes["key"] = controlElement.ConfigKey; if (span != null && span.Length > count) { int columnSpan = 1; int.TryParse(span[count], out columnSpan); tc.ColumnSpan = columnSpan; if (rowspan != null && rowspan.Length > count) { int rowSpan = 1; int.TryParse(rowspan[count], out rowSpan); tc.RowSpan = rowSpan; } count++; } tr.Cells.Add(tc); string pullpush = null; foreach (IConfigurationElement propertyElement in controlElement.Elements.Values) { if (propertyElement.Attributes.ContainsKey("for") && "cell" == propertyElement.GetAttributeReference("for").Value.ToString() && propertyElement.Attributes.ContainsKey("member") && propertyElement.Attributes.ContainsKey("value")) { try { ReflectionServices.SetValue(tc, propertyElement.GetAttributeReference("member").Value.ToString(), propertyElement.GetAttributeReference("value").Value); } catch (Exception ex) { ControlFactory.Instance.Monitor.Register(ControlFactory.Instance, ControlFactory.Instance.Monitor.NewEventInstance("set cell attributes error", null, ex, EVENT_TYPE.Error)); } } if (propertyElement.Attributes.ContainsKey("pull")) { pullpush = propertyElement.GetAttributeReference("pull").Value.ToString(); } else { if (propertyElement.Attributes.ContainsKey("push")) { pullpush = propertyElement.GetAttributeReference("push").Value.ToString(); } } } Control cellControl = ControlFactory.Instance.CreateControl(controlElement, index, binder, item, tc, invalidStyle, registry, manager); if (null != cellControl) { cellControl.ID = string.Concat(new string[] { table.ID, "-", element.ConfigKey, "-", index, "-", controlElement.ConfigKey, "-ctrl" }); tc.Controls.Add(cellControl); if (cellControl is BaseDataBoundControl && !string.IsNullOrEmpty(pullpush)) { if (!item.BoundControls.ContainsKey(pullpush)) { item.BoundControls.Add(pullpush, new List <BaseDataBoundControl>()); } item.BoundControls[pullpush].Add((BaseDataBoundControl)cellControl); } } } }
public override IResult Parse(object source) { WorkFlowManagerWebPart workflowManagerWebPart = source as WorkFlowManagerWebPart; if (null == workflowManagerWebPart) { throw new ArgumentException("source is not a WorkFlowManagerWebPart"); } IConfiguration configuration = workflowManagerWebPart.Configuration; if (null == configuration) { throw new ArgumentException("source does not have a configuration"); } WebPartManager Manager = WebPartManager.GetCurrentWebPartManager(workflowManagerWebPart.Page); if (configuration.Sections.ContainsKey("flows")) { WorkFlow.WorkFlow flow = new WorkFlow.WorkFlow(); flow.Monitor = workflowManagerWebPart.Monitor; flow.Title = "screen flow"; IConfigurationSection flowsSection = configuration.GetConfigurationSectionReference("flows"); foreach (IConfigurationElement flowElement in flowsSection.Elements.Values) { Job job = new Job(); job.Monitor = workflowManagerWebPart.Monitor; job.Title = flowElement.ConfigKey; if (flowElement.Elements.ContainsKey("conditions")) { foreach (IConfigurationElement conditionElement in flowElement.Elements["conditions"].Elements.Values) { if (flowElement.Elements["conditions"].Attributes.ContainsKey("type")) { ReflectionServices.SetValue(job.Conditions, "Type", flowElement.Elements["conditions"].GetAttributeReference("type").Value.ToString()); } if (conditionElement.Attributes.ContainsKey("waitfor") && !("waitfor" == conditionElement.GetAttributeReference("type").Value.ToString())) { throw new InvalidOperationException("Unknown condition type " + conditionElement.GetAttributeReference("type").Value.ToString()); } WaitForCondition condition = new WaitForCondition(); condition.Monitor = workflowManagerWebPart.Monitor; if (conditionElement.Attributes.ContainsKey("milestone")) { condition.Milestone = conditionElement.GetAttributeReference("milestone").Value.ToString(); } if (conditionElement.Attributes.ContainsKey("sender")) { condition.Chronicler = (ReflectionServices.FindControlEx(conditionElement.GetAttributeReference("sender").Value.ToString(), Manager) as IChronicler); } condition.Target = job; job.Conditions.Add(condition); if (conditionElement.Elements.ContainsKey("expression")) { IConfigurationElement expressionElement = conditionElement.GetElementReference("expression"); IExpression expression = workflowManagerWebPart.ExpressionsManager.Token(expressionElement.GetAttributeReference("type").Value.ToString()) as IExpression; if (null != expression) { expression.Make(expressionElement, workflowManagerWebPart.ExpressionsManager); condition.Expression = expression; } } } } if (flowElement.Elements.ContainsKey("transits")) { foreach (IConfigurationElement transitElement in flowElement.GetElementReference("transits").Elements.Values) { if (transitElement.Attributes.ContainsKey("key")) { Transit transit = new Transit(); transit.Monitor = workflowManagerWebPart.Monitor; transit.Title = transitElement.ConfigKey; transit.Key = transitElement.GetAttributeReference("key").Value.ToString(); transit.Storage = workflowManagerWebPart.StatePersistence; if (transitElement.Elements.ContainsKey("expression")) { IConfigurationElement expressionElement = transitElement.GetElementReference("expression"); IExpression expression = workflowManagerWebPart.ExpressionsManager.Token(expressionElement.GetAttributeReference("type").Value.ToString()) as IExpression; if (null == expression) { throw new InvalidOperationException("Token is not an IExpression"); } expression.Make(expressionElement, workflowManagerWebPart.ExpressionsManager); transit.Expression = expression; } if (transitElement.Elements.ContainsKey("source")) { transit.Source = this.CreateTransitPoint(Manager, transitElement.GetElementReference("source"), workflowManagerWebPart.ExpressionsManager); } if (transitElement.Elements.ContainsKey("destination")) { transit.Destination = this.CreateTransitPoint(Manager, transitElement.GetElementReference("destination"), workflowManagerWebPart.ExpressionsManager); } if (transitElement.Attributes.ContainsKey("persistent")) { transit.IsPersistent = bool.Parse(transitElement.GetAttributeReference("persistent").Value.ToString()); } job.Transits.Add(transit); } } } flow.Jobs.Add(job); } workflowManagerWebPart.WorkFlows.Add(flow); } return(null); }
private BoundField GetField(IConfigurationElement element) { if (element.Attributes.ContainsKey("type")) { string type = element.Attributes["type"].Value.ToString(); BoundField field; switch (type) { case "Text": { field = new BoundField(); break; } case "Label": { field = new BoundField(); field.ReadOnly = true; break; } case "Date": { field = new DateBoundField(); break; } case "Number": { field = new NumberBoundField(); break; } case "DropDownList": { field = new DropDownListField(); break; } case "CheckBox": case "Check": { field = new CheckBoxField(); break; } case "Hidden": { field = new BoundField(); field.ItemStyle.CssClass = "hidden"; break; } default: { throw new ArgumentException("Unknown grid view field type '" + element.Attributes["type"].Value.ToString() + "'"); } } if (!(field is CheckBoxField)) { field.HtmlEncode = false; } if (element.Attributes.ContainsKey("DataMember")) field.DataField = element.Attributes["DataMember"].Value.ToString(); ; if (element.Attributes.ContainsKey("HeaderText")) field.HeaderText = element.Attributes["HeaderText"].Value.ToString(); ; if (element.Attributes.ContainsKey("FormatString")) { try { field.DataFormatString = element.Attributes["FormatString"].Value.ToString(); } catch { } } if (field is DropDownListField) { if (element.Attributes.ContainsKey("DataTextField")) { ((DropDownListField)field).DataTextField = element.GetAttributeReference("DataTextField").Value.ToString(); } if (element.Attributes.ContainsKey("DataValueField")) { ((DropDownListField)field).DataValueField = element.GetAttributeReference("DataValueField").Value.ToString(); } } return field; } return null; }
public virtual void DisplayItem(Table table, IConfigurationElement element, string index, IBinder binder, ITemplatingItem item, TableItemStyle style, TableItemStyle invalidStyle, Dictionary<string, Control> registry, WebPartManager manager) { string[] span = null; if (element.Attributes.ContainsKey("span") && null != element.GetAttributeReference("span").Value) span = element.GetAttributeReference("span").Value.ToString().Split(new char[] { ',' }); string[] rowspan = null; if (element.Attributes.ContainsKey("rowspan") && null != element.GetAttributeReference("rowspan").Value) rowspan = element.GetAttributeReference("rowspan").Value.ToString().Split(new char[] { ',' }); TableRow tr = new TableRow(); tr.ID = string.Concat(new string[] { table.ID, "-", element.ConfigKey, "-", index }); tr.Attributes["key"] = element.ConfigKey; tr.ApplyStyle(style); foreach (IConfigurationElementAttribute attribute in element.Attributes.Values) { if ("span" != attribute.ConfigKey && "rowspan" != attribute.ConfigKey) { tr.Style.Add(attribute.ConfigKey, attribute.Value.ToString()); } } table.Rows.Add(tr); int count = 0; foreach (IConfigurationElement controlElement in element.Elements.Values) { TableCell tc = new TableCell(); tc.ID = tr.ID + "-" + controlElement.ConfigKey; tc.Attributes["key"] = controlElement.ConfigKey; if (span != null && span.Length > count) { int columnSpan = 1; int.TryParse(span[count], out columnSpan); tc.ColumnSpan = columnSpan; if (rowspan != null && rowspan.Length > count) { int rowSpan = 1; int.TryParse(rowspan[count], out rowSpan); tc.RowSpan = rowSpan; } count++; } tr.Cells.Add(tc); string pullpush = null; foreach (IConfigurationElement propertyElement in controlElement.Elements.Values) { if (propertyElement.Attributes.ContainsKey("for") && "cell" == propertyElement.GetAttributeReference("for").Value.ToString() && propertyElement.Attributes.ContainsKey("member") && propertyElement.Attributes.ContainsKey("value")) { try { ReflectionServices.SetValue(tc, propertyElement.GetAttributeReference("member").Value.ToString(), propertyElement.GetAttributeReference("value").Value); } catch (Exception ex) { ControlFactory.Instance.Monitor.Register(ControlFactory.Instance, ControlFactory.Instance.Monitor.NewEventInstance("set cell attributes error", null, ex, EVENT_TYPE.Error)); } } if (propertyElement.Attributes.ContainsKey("pull")) { pullpush = propertyElement.GetAttributeReference("pull").Value.ToString(); } else { if (propertyElement.Attributes.ContainsKey("push")) { pullpush = propertyElement.GetAttributeReference("push").Value.ToString(); } } } Control cellControl = ControlFactory.Instance.CreateControl(controlElement, index, binder, item, tc, invalidStyle, registry, manager); if (null != cellControl) { cellControl.ID = string.Concat(new string[] { table.ID, "-", element.ConfigKey, "-", index, "-", controlElement.ConfigKey, "-ctrl" }); tc.Controls.Add(cellControl); if (cellControl is BaseDataBoundControl && !string.IsNullOrEmpty(pullpush)) { if (!item.BoundControls.ContainsKey(pullpush)) { item.BoundControls.Add(pullpush, new List<BaseDataBoundControl>()); } item.BoundControls[pullpush].Add((BaseDataBoundControl)cellControl); } } } }