Beispiel #1
0
        public static MvcHtmlString BallyLabel <TModel, TProperty>(this HtmlHelper <TModel> htmlHelper, Expression <Func <TModel, TProperty> > expression, StylePropertyBag style = null, string cssClass = "", IDictionary <string, object> attributes = null)
        {
            string propertyName    = string.Empty;
            string modelName       = string.Empty;
            object value           = string.Empty;
            string errMsg          = string.Empty;
            string labelHTMLString = string.Empty;
            string configKey       = string.Empty;
            Dictionary <string, string> overrideSettings;

            ControlExtension.GetPropertyNameAndValue <TModel, TProperty>(htmlHelper, expression, out propertyName, out modelName, out value, out errMsg, out configKey, false);

            overrideSettings = GetLabelOverrideSettings(DisplayType.Label, style, cssClass: cssClass);

            var          fillers          = ControlPropertyFillerFactory.Get();
            FillerParams fillerParams     = new FillerParams(modelName, propertyName, overrideSettings, attributes: attributes, configKey: configKey);
            var          labelPropertyBag = new LabelPropertyBag(fillerParams);

            labelPropertyBag.Accept(fillers);

            var labelHTMLEmitter = new LabelHTMLEmitter(value != null ? value.ToString() : string.Empty, labelPropertyBag);

            labelHTMLEmitter.Emit(out labelHTMLString);
            return(MvcHtmlString.Create(labelHTMLString));
        }
Beispiel #2
0
        public static MvcHtmlString BallyLabel(this HtmlHelper htmlHelper, string controlID, string externalizationKey, bool isMandatory = false, StylePropertyBag style = null, string cssClass = "", IDictionary <string, object> attributes = null)
        {
            string propertyName    = controlID;
            string modelName       = string.Empty;
            string labelHTMLString = string.Empty;
            Dictionary <string, string> overrideSettings;

            overrideSettings = GetLabelOverrideSettings(DisplayType.Label, style, cssClass: cssClass);

            var          fillers          = ControlPropertyFillerFactory.Get();
            FillerParams fillerParams     = new FillerParams(modelName, propertyName, overrideSettings, skipBehaviourFill: true, skipSecurityFill: true, skipValidationFill: true, isBindingControl: false, externalizationKey: externalizationKey, attributes: attributes);
            var          labelPropertyBag = new LabelPropertyBag(fillerParams);

            labelPropertyBag.Accept(fillers);

            labelPropertyBag.IsMandatory      = isMandatory;
            labelPropertyBag.IsBindingControl = false;
            var labelHTMLEmitter = new LabelHTMLEmitter(string.Empty, labelPropertyBag);

            labelHTMLEmitter.Emit(out labelHTMLString);
            return(MvcHtmlString.Create(labelHTMLString));
        }
Beispiel #3
0
        public static MvcHtmlString BallyTextBlock(this HtmlHelper htmlHelper, object value, string controlID, string externalizationKey, bool isCurrency = false, bool masking = false, StylePropertyBag style = null, string cssClass = "", IDictionary <string, object> attributes = null, string toolTip = "")
        {
            string propertyName    = controlID;
            string modelName       = string.Empty;
            string labelHTMLString = string.Empty;
            Dictionary <string, string> overrideSettings;

            overrideSettings = GetLabelOverrideSettings(DisplayType.TextBlock, style, isCurrency: isCurrency, cssClass: cssClass, overrideToolTip: toolTip);

            var          fillers          = ControlPropertyFillerFactory.Get();
            FillerParams fillerParams     = new FillerParams(modelName, propertyName, overrideSettings, skipBehaviourFill: true, skipSecurityFill: true, skipValidationFill: true, isBindingControl: false, externalizationKey: externalizationKey, attributes: attributes);
            var          labelPropertyBag = new LabelPropertyBag(fillerParams);

            labelPropertyBag.Accept(fillers);

            labelPropertyBag.IsBindingControl = false;
            labelPropertyBag.Masking          = masking;
            value = GetLabelMaskingData(propertyName, modelName, value, labelPropertyBag);

            var labelHTMLEmitter = new LabelHTMLEmitter(value != null ? value.ToString() : string.Empty, labelPropertyBag);

            labelHTMLEmitter.Emit(out labelHTMLString);
            return(MvcHtmlString.Create(labelHTMLString));
        }