//------------------------------------------------------------------------------ // // Copyright (c) Microsoft Corporation. All rights reserved. // //------------------------------------------------------------------------------ namespace System.Web.UI { using System.Reflection; using System.Web.Util; using System.Web.Compilation; using System.ComponentModel.Design; using System.Security.Permissions; /// /// PropertyEntry for any bound properties /// public class BoundPropertyEntry : PropertyEntry { private string _expression; private ExpressionBuilder _expressionBuilder; private string _expressionPrefix; private bool _useSetAttribute; private object _parsedExpressionData; private bool _generated; private string _fieldName; private string _formatString; private string _controlID; private Type _controlType; private bool _readOnlyProperty; private bool _twoWayBound; internal BoundPropertyEntry() { } /// /// The id of the control that contains this binding. /// public string ControlID { get { return _controlID; } set { _controlID = value; } } /// /// The type of the control which is being bound to a runtime value. /// public Type ControlType { get { return _controlType; } set { _controlType = value; } } /// /// public string Expression { get { return _expression; } set { _expression = value; } } public ExpressionBuilder ExpressionBuilder { get { return _expressionBuilder; } set { _expressionBuilder = value; } } public string ExpressionPrefix { get { return _expressionPrefix; } set { _expressionPrefix = value; } } /// /// The name of the data field that is being bound to. /// public string FieldName { get { return _fieldName; } set { _fieldName = value; } } /// /// The format string applied to the field for display. /// public string FormatString { get { return _formatString; } set { _formatString = value; } } internal bool IsDataBindingEntry { // Empty prefix means it's a databinding expression (i.e. <%# ... %>) get { return String.IsNullOrEmpty(ExpressionPrefix); } } /// /// This represents the column value where the property value begins. /// Currently only calculated for data bound property entries, for other type /// of Bound Properties it has default value which is 0. /// internal int Column { get; set; } /// /// This represents the line value where the property value is present. /// Currently only calculated for data bound property entries, for other type /// of Bound Properties it has default value which is 0. /// internal int Line { get; set; } public bool Generated { get { return _generated; } set { _generated = value; } } public object ParsedExpressionData { get { return _parsedExpressionData; } set { _parsedExpressionData = value; } } /// /// Indicates whether the two way statement is set and get, or just get but not set. /// public bool ReadOnlyProperty { get { return _readOnlyProperty; } set { _readOnlyProperty = value; } } public bool TwoWayBound { get { return _twoWayBound; } set { _twoWayBound = value; } } /// /// public bool UseSetAttribute { get { return _useSetAttribute; } set { _useSetAttribute = value; } } public bool IsEncoded { get; set; } // Parse the expression, and store the resulting object internal void ParseExpression(ExpressionBuilderContext context) { if (Expression == null || ExpressionPrefix == null || ExpressionBuilder == null) return; _parsedExpressionData = ExpressionBuilder.ParseExpression(Expression, Type, context); } } }