public static MvcHtmlString BallyCheckBox <TModel, TProperty>(this HtmlHelper <TModel> htmlHelper, Expression <Func <TModel, TProperty> > expression, StylePropertyBag style = null, short tabIndex = 0, string onClickFunction = "", string cssClass = "", IDictionary <string, object> attributes = null, bool?isEnabled = null) { string propertyName = string.Empty; string modelName = string.Empty; object value = string.Empty; string errMsg = string.Empty; string checkBoxHTMLString = 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); if (value == null) { value = false; } overrideSettings = GetCheckBoxOverrideSettings(style, tabIndex, onClickFunction, cssClass); var fillers = ControlPropertyFillerFactory.Get(); FillerParams fillerParams = new FillerParams(modelName, propertyName, overrideSettings, attributes: attributes, isEnabled: isEnabled, configKey: configKey); var checkBoxpropertyBag = new CheckBoxPropertyBag(fillerParams); checkBoxpropertyBag.Accept(fillers); checkBoxpropertyBag.ErrorMessage = errMsg; checkBoxpropertyBag.IsDirty = string.IsNullOrEmpty(errMsg) ? false : true; var checkBoxHTMLEmitter = new CheckBoxHTMLEmitter(value != null ? value.ToString() : string.Empty, checkBoxpropertyBag); checkBoxHTMLEmitter.Emit(out checkBoxHTMLString); return(MvcHtmlString.Create(checkBoxHTMLString)); }
public override void Fill(CheckBoxPropertyBag propertyBag, FillerParams fillerParams) { if (fillerParams.OverrideSettings != null && fillerParams.OverrideSettings.Count > 0) { propertyBag.TabIndex = Convert.ToInt16(fillerParams.OverrideSettings[ControlLibConstants.TAB_INDEX]); propertyBag.OnClickFunction = fillerParams.OverrideSettings[ControlLibConstants.ON_CLICK_FUNCTION]; propertyBag.Attributes = fillerParams.Attributes; if (propertyBag.Style == null && (fillerParams.OverrideSettings.Keys.Contains(ControlLibConstants.WIDTH) || fillerParams.OverrideSettings.Keys.Contains(ControlLibConstants.HEIGHT))) { propertyBag.Style = new StylePropertyBag(); } if (propertyBag.Style != null) { propertyBag.Style.Width = fillerParams.OverrideSettings.Keys.Contains(ControlLibConstants.WIDTH) ? fillerParams.OverrideSettings[ControlLibConstants.WIDTH] : string.Empty; propertyBag.Style.Height = fillerParams.OverrideSettings.Keys.Contains(ControlLibConstants.HEIGHT) ? fillerParams.OverrideSettings[ControlLibConstants.HEIGHT] : string.Empty; } if (fillerParams.OverrideSettings[ControlLibConstants.CSS_CLASS] != string.Empty) { propertyBag.CssClass = fillerParams.OverrideSettings[ControlLibConstants.CSS_CLASS]; } } propertyBag.ReadOnly = fillerParams.IsReadOnly.HasValue ? fillerParams.IsReadOnly.Value : propertyBag.ReadOnly; propertyBag.Enabled = fillerParams.IsEnabled.HasValue ? fillerParams.IsEnabled.Value : propertyBag.Enabled; SetVisibility(propertyBag, fillerParams); }
public override void Fill(CheckBoxPropertyBag propertyBag, FillerParams fillerParams) { if (fillerParams.SkipSecurityFill == false) { IModelPropertyConfiguration propertyConfig = ReadPropertyConfiguration(fillerParams.ModelName, fillerParams.PropertyName, fillerParams.ConfigKey); if (propertyConfig != null && propertyConfig.PropertyConfiguration != null) { IAccessPolicy accessSecurity = GetAccess(propertyConfig.PropertyConfiguration.Security); if (accessSecurity != null) { propertyBag.Enabled = accessSecurity.Enabled; propertyBag.ReadOnly = accessSecurity.ReadOnly; propertyBag.Visibility = accessSecurity.Visibility; } } else { setDefalutSecurity(propertyBag); } } else { setDefalutSecurity(propertyBag); } }
public override void Fill(CheckBoxPropertyBag propertyBag, FillerParams fillerParams) { propertyBag.ControlName = fillerParams.ControlName; IControlDefaultPropertyBag controlDefault = ReadDefaultConfiguration(ControlNames.BallyCheckBox); if (controlDefault != null) { propertyBag.CssClass = controlDefault.CssClass; propertyBag.ValidationErrorCssClass = controlDefault.ValidationErrorCssClass; propertyBag.ControlErrorCssClass = controlDefault.ControlErrorCssClass; } }
public CheckBoxHTMLEmitter(string value, CheckBoxPropertyBag propertyBag) : base(propertyBag.Validators, propertyBag.Mandatory) { this._propertyBag = propertyBag; this.Value = value; }
public virtual void Fill(CheckBoxPropertyBag propertyBag, FillerParams fillerParams) { }