public RouteValueDictionary SetBaseAttribute(ComboBoxConfigContainer <TModel, TValue> configuration) { var attributes = configuration.HtmlAttributes == null ? new RouteValueDictionary() : new RouteValueDictionary(configuration.HtmlAttributes); attributes["serverFiltering"] = false; attributes["placeHolder"] = configuration.PlaceHolder; attributes["customType"] = "text"; attributes["name"] = GetFieldName(configuration); attributes["id"] = string.Format("{0}{1}", GetFieldName(configuration), configuration.Index); attributes["onchange"] = StringifyOnChange(configuration.ClientEvent); attributes["onblur"] = StringifyOnBlur(configuration.ClientEvent); attributes["key"] = configuration.Key; StatefulStorage.PerSession.GetOrAdd(configuration.Key, () => configuration.Specification); return(attributes); }
private UrlParameterContainer ConfigureUrlAndParameter(ComboBoxConfigContainer <TModel, TValue> configuration) { UrlParameterContainer urlParameterContainer; var customDataSourceAction = (Action <ICustomActionDataSource>)configuration.DataSource; var customDataSource = new CustomActionDataSource(); customDataSourceAction(customDataSource); if (customDataSource.Configuration.Url != null) { urlParameterContainer = new UrlParameterContainer(customDataSource.Configuration.Url, customDataSource.Configuration.Parameter); } else { var readAction = new ReadAction(); customDataSource.Configuration.ReadAction(readAction); var urlHelper = new UrlHelper(configuration.HtmlHelper.ViewContext.RequestContext); var url = urlHelper.Action(readAction.Configuration.Action, readAction.Configuration.Controller); urlParameterContainer = new UrlParameterContainer(url, readAction.Configuration.Parameter); } return(urlParameterContainer); }
public ComboBoxConfigurator(ComboBoxConfigContainer <TModel, TValue> configuration) { _configuration = configuration; }
public string GetFieldName(ComboBoxConfigContainer <TModel, TValue> configuration) { var fieldId = GetMetadata(configuration).PropertyName; return(fieldId); }
public string GetValueFromMetaData(ComboBoxConfigContainer <TModel, TValue> configuration) { var value = GetMetadata(configuration).Model == null ? string.Empty : GetMetadata(configuration).Model.ToString(); return(value); }
public ModelMetadata GetMetadata(ComboBoxConfigContainer <TModel, TValue> configuration) { return(ModelMetadata.FromLambdaExpression(configuration.TargetExpression, configuration.HtmlHelper.ViewData)); }
public ComboBoxHtmlRenderer(ComboBoxConfigContainer <TModel, TValue> configuration) { Configuration = configuration; }