public static MvcHtmlString BallyTemplateListBox <TModel, TProperty>(this HtmlHelper <TModel> htmlHelper, Expression <Func <TModel, TProperty> > expression, string templateNameKey, ItemDataSource dataSource, int listLength = -1, StylePropertyBag style = null, short tabIndex = 0, string onClickFunction = "", string listItemTemplateCssClass = "", string listItemMouseOverCssClass = "", string listItemSelectedCssClass = "", string cssClass = "") { string propertyName = string.Empty; string modelName = string.Empty; object value = string.Empty; string errMsg = string.Empty; string controlHtmlString = string.Empty; string configKey = string.Empty; Dictionary <string, string> overrideSettings; TemplateListHTMLEmitter controlHtmlEmitter; ControlExtension.GetPropertyNameAndValue <TModel, TProperty>(htmlHelper, expression, out propertyName, out modelName, out value, out errMsg, out configKey); overrideSettings = GetBallyTemplateListBoxOverrideSettings(templateNameKey, listLength, style, tabIndex, onClickFunction, value, listItemTemplateCssClass, listItemMouseOverCssClass, listItemSelectedCssClass, cssClass); FillerParams fillerParams = null; if (dataSource != null) { fillerParams = new FillerParams(modelName, propertyName, overrideSettings, list: dataSource.DataSource, valueMember: dataSource.ValueMember, param: dataSource.DisplayParams, templateKeyName: templateNameKey, listType: ListBoxType.MultiColumnList, configKey: configKey); } else { fillerParams = new FillerParams(modelName, propertyName, overrideSettings, list: null, valueMember: string.Empty, param: null, templateKeyName: templateNameKey, listType: ListBoxType.MultiColumnList, configKey: configKey); } var fillers = ControlPropertyFillerFactory.Get(); var controlPropertyBag = new TemplateListPropertyBag(fillerParams); controlPropertyBag.Accept(fillers); controlPropertyBag.ErrorMessage = errMsg; controlPropertyBag.IsDirty = string.IsNullOrEmpty(errMsg) ? false : true; controlHtmlEmitter = new TemplateListHTMLEmitter(value != null ? value.ToString() : string.Empty, controlPropertyBag); controlHtmlEmitter.Emit(out controlHtmlString); return(MvcHtmlString.Create(controlHtmlString)); }
public static MvcHtmlString BallyCheckBoxList <TModel, TProperty>(this HtmlHelper <TModel> htmlHelper, Expression <Func <TModel, TProperty> > expression, ItemDataSource dataSource, int listLength = -1, string[] disabled = null, StylePropertyBag style = null, short tabIndex = 0, string onClickFunction = "", bool isVerticalAllign = false, string cssClass = "") { string propertyName = string.Empty; string modelName = string.Empty; object value = string.Empty; string errMsg = string.Empty; string chkBoxListHTMLString = string.Empty; Dictionary <string, string> overrideSettings; string configKey = string.Empty; CheckBoxListHTMLEmitter checkBoxListHTMLEmitter; ControlExtension.GetPropertyNameAndValue <TModel, TProperty>(htmlHelper, expression, out propertyName, out modelName, out value, out errMsg, out configKey); overrideSettings = GetCheckBoxListOverrideSettings(listLength, style, tabIndex, onClickFunction, isVerticalAllign, value, cssClass); FillerParams fillerParams = null; if (dataSource != null) { fillerParams = new FillerParams(modelName, propertyName, overrideSettings, list: dataSource.DataSource, valueMember: dataSource.ValueMember, displayMember: dataSource.DisplayMember, configKey: configKey); } else { fillerParams = new FillerParams(modelName, propertyName, overrideSettings, list: null, valueMember: string.Empty, displayMember: string.Empty, configKey: configKey); } var fillers = ControlPropertyFillerFactory.Get(); var chkListpropertyBag = new CheckBoxListPropertyBag(fillerParams); chkListpropertyBag.Accept(fillers); chkListpropertyBag.ErrorMessage = errMsg; chkListpropertyBag.IsDirty = string.IsNullOrEmpty(errMsg) ? false : true; checkBoxListHTMLEmitter = new CheckBoxListHTMLEmitter(value != null ? value.ToString() : string.Empty, chkListpropertyBag); checkBoxListHTMLEmitter.Emit(out chkBoxListHTMLString); return(MvcHtmlString.Create(chkBoxListHTMLString)); }
public static MvcHtmlString BallyCascadeDropDown <TModel, TProperty>(this HtmlHelper <TModel> htmlHelper, Expression <Func <TModel, TProperty> > expression, NameGenerator controlId, string actionUrl, ItemDataSource dataSource, string[] disabled = null, int listLength = -1, StylePropertyBag style = null, short tabIndex = 0, string onChangeFunction = "", string cssClass = "", string cascadeInputFunction = "", IDictionary <string, object> attributes = null) { string propertyName = string.Empty; string targetControlID = controlId.ControlID; string modelName = string.Empty; object value = string.Empty; string errMsg = string.Empty; string dropDownHTMLString = string.Empty; Dictionary <string, string> overrideSettings; string configKey = string.Empty; DropDownHTMLEmitter dropDownHTMLEmitter; ControlExtension.GetPropertyNameAndValue <TModel, TProperty>(htmlHelper, expression, out propertyName, out modelName, out value, out errMsg, out configKey); overrideSettings = GetBallyDropdownListOverrideSettings(DropDownType.CascadeSelect, listLength, targetControlID, actionUrl, style, tabIndex, onChangeFunction, value, cssClass, cascadeInputFunction); FillerParams fillerParams = null; if (dataSource != null) { fillerParams = new FillerParams(modelName, propertyName, overrideSettings, list: dataSource.DataSource, valueMember: dataSource.ValueMember, displayMember: dataSource.DisplayMember, disabled: disabled, attributes: attributes, configKey: configKey); } else { fillerParams = new FillerParams(modelName, propertyName, overrideSettings, list: null, valueMember: string.Empty, displayMember: string.Empty, disabled: disabled, attributes: attributes, configKey: configKey); } var fillers = ControlPropertyFillerFactory.Get(); var dropDownpropertyBag = new DropDownPropertyBag(fillerParams); dropDownpropertyBag.Accept(fillers); dropDownpropertyBag.ErrorMessage = errMsg; dropDownpropertyBag.IsDirty = string.IsNullOrEmpty(errMsg) ? false : true; dropDownHTMLEmitter = new DropDownHTMLEmitter(value != null ? value.ToString() : string.Empty, dropDownpropertyBag); dropDownHTMLEmitter.Emit(out dropDownHTMLString); return(MvcHtmlString.Create(dropDownHTMLString)); }