コード例 #1
0
        /// <summary>
        /// Display name for the property.
        /// </summary>
        public string GetDisplayName()
        {
            string result = null;

            if (DisplayName != null)
            {
                result = DisplayName.GetString();
            }

            if (result == null)
            {
                result = PropertyName.SplitPascalCase();
            }

            return(result);
        }
コード例 #2
0
ファイル: Validator.cs プロジェクト: ne4ta/SpecExpress
        /// <summary>
        ///Try and get the Property Name from label, if not found, default to PropertyName
        /// </summary>
        /// <returns></returns>
        private string GetLabelName()
        {
            string labelName;
            var    labelControl = Page.Controls.All().OfType <Label>().Where(x => x.AssociatedControlID == ControlToValidate).FirstOrDefault();

            if (labelControl == null)
            {
                //TODO: Get UI friendly name from PropertyValidator
                //Label control not found, default to type name
                labelName = PropertyName.SplitPascalCase();
            }
            else
            {
                labelName = labelControl.Text.Replace(":", "");
            }
            return(labelName);
        }