public static IBindingsBuilder <T> Text <T, F>( this IBindingsBuilder <T> bindingsBuilder, Expression <Func <T, F> > expression, string format = null, params LambdaExpression[] otherExpressions) where T : class { if (expression == null) { throw (new ArgumentNullException("expression")); } if (format == null) { string clientFormat; string prefix; string postfix; string nullString; int clientType = CoreHTMLHelpers. GetClientInfo(expression, out clientFormat, out prefix, out postfix, out nullString); bindingsBuilder.Add( string.Format(textScript, bindingsBuilder.GetFullBindingName(expression), clientFormat, clientType, prefix, postfix, nullString) ); return(bindingsBuilder); } bindingsBuilder.Add( bindingsBuilder.standardString <T, F>("text", expression, format, otherExpressions) ); return(bindingsBuilder); }
public static IBindingsBuilder <T> Value <T, F>( this IBindingsBuilder <T> bindingsBuilder, Expression <Func <T, F> > expression) { if (expression == null) { throw (new ArgumentNullException("expression")); } string clientFormat; string prefix; string postfix; string nullString; int clientType = CoreHTMLHelpers. GetClientInfo(expression, out clientFormat, out prefix, out postfix, out nullString); bindingsBuilder.Add( bindingsBuilder.standardString <T, F>("value", expression, null, null) ); bindingsBuilder.Add("valueType: " + clientType); if (clientFormat.Length > 0) { bindingsBuilder.Add("formatString: "" + clientFormat + """); } return(bindingsBuilder); }
private static MvcHtmlString _cond <T, F>( this HtmlHelper <T> htmlHelper, Expression <Func <T, F> > expression, ExternalContainerType itemsContainer = ExternalContainerType.koComment, object htmlAttributes = null, string afterRender = null, bool negateCondition = false, string format = null, params LambdaExpression[] otherExpressions) { if (expression == null) { throw (new ArgumentNullException("expression")); } IDictionary <string, object> attributes = null; if (htmlAttributes == null) { attributes = new RouteValueDictionary(); } else if (htmlAttributes is IDictionary <string, object> ) { attributes = htmlAttributes as IDictionary <string, object>; } else { attributes = new RouteValueDictionary(htmlAttributes); } IBindingsBuilder <T> bindings = htmlHelper.ClientBindings(); if (bindings == null) { throw (new ArgumentNullException("bindings")); } string bindingsValue = string.Format( ifScript, bindings.standardString(negateCondition ? "ifnot" : "if", expression, format, otherExpressions), bindings.ValidationType == "UnobtrusiveClient" ? "true" : "false", afterRender == null ? "null" : afterRender); if (attributes.ContainsKey("data-bind")) { attributes["data-bind"] = (attributes["data-bind"] as string) + ", " + bindingsValue; } else { attributes["data-bind"] = bindingsValue; } attributes["data-nobinding"] = "true"; string openTag; string closeTag; BasicHtmlHelper.GetContainerTags(itemsContainer, attributes, out openTag, out closeTag); htmlPush("_ClientControlsFlowStack_", closeTag); return(MvcHtmlString.Create( openTag )); }
public static IBindingsBuilder <T> Submit <T, F>( this IBindingsBuilder <T> bindingsBuilder, Expression <Func <T, F> > expression, string format = null, params LambdaExpression[] otherExpressions) where T : class { if (expression == null) { throw (new ArgumentNullException("expression")); } bindingsBuilder.Add( bindingsBuilder.standardString <T, F>("submit", expression, format, otherExpressions) ); return(bindingsBuilder); }
public static IBindingsBuilder <T> SelectedOptions <T, F>( this IBindingsBuilder <T> bindingsBuilder, Expression <Func <T, F> > expression, string format = null, params LambdaExpression[] otherExpressions) { if (expression == null) { throw (new ArgumentNullException("expression")); } bindingsBuilder.Add( bindingsBuilder.standardString <T, F>("selectedOptions", expression, format, otherExpressions) ); bindingsBuilder.Add("valueType: " + CoreHTMLHelpers.GetClientType(typeof(F))); return(bindingsBuilder); }
public static IBindingsBuilder <T> Options <T, F>( this IBindingsBuilder <T> bindingsBuilder, Expression <Func <T, F> > expression, string caption = null) { if (expression == null) { throw (new ArgumentNullException("expression")); } bindingsBuilder.Add( bindingsBuilder.standardString <T, F>("options", expression, null, null) ); int clientType = CoreHTMLHelpers.GetClientType(typeof(F)); bindingsBuilder.Add("valueType: " + clientType); if (!string.IsNullOrWhiteSpace(caption)) { bindingsBuilder.Add("optionsCaption: "" + caption + """); } return(bindingsBuilder); }
public static IBindingsBuilder <T> Options <T, F, IF, IFT>( this IBindingsBuilder <T> bindingsBuilder, Expression <Func <T, IEnumerable <F> > > expression, Expression <Func <F, IF> > valueField, Expression <Func <F, IFT> > textField, string caption = null, string valueFieldFormat = null, string textFieldFormat = null) { if (expression == null) { throw (new ArgumentNullException("expression")); } bindingsBuilder.Add( bindingsBuilder.standardString <T, IEnumerable <F> >("options", expression, null, null) ); if (valueFieldFormat == null) { bindingsBuilder.Add("optionsValue: "" + ExpressionHelper.GetExpressionText(valueField) + """); } else { bindingsBuilder.Add( baseStandardString <F, IF>("optionsValue", valueField, valueFieldFormat, null) ); } string clientFormat; string prefix; string postfix; string nullString; int clientType = CoreHTMLHelpers. GetClientInfo(valueField, out clientFormat, out prefix, out postfix, out nullString); bindingsBuilder.Add("valueType: " + clientType); if (clientFormat.Length > 0) { bindingsBuilder.Add("formatString: "" + clientFormat + """); } if (textFieldFormat == null) { bindingsBuilder.Add("optionsText: "" + ExpressionHelper.GetExpressionText(textField) + """); } else { bindingsBuilder.Add( baseStandardString <F, IFT>("optionsText", textField, textFieldFormat, null) ); } clientType = CoreHTMLHelpers. GetClientInfo(textField, out clientFormat, out prefix, out postfix, out nullString); bindingsBuilder.Add("textType: " + clientType); if (clientFormat.Length > 0) { bindingsBuilder.Add("textFormatString: "" + clientFormat + """); } bindingsBuilder.Add("textPrefix: "" + prefix + """); bindingsBuilder.Add("textPostfix: "" + postfix + """); bindingsBuilder.Add("textNullString: "" + nullString + """); if (!string.IsNullOrWhiteSpace(caption)) { bindingsBuilder.Add("optionsCaption: "" + caption + """); } return(bindingsBuilder); }