Exemple #1
0
        public static ComponentBuilder <MvcBootstrapConfig <TModel>, TTag> For <TTag, TModel, TValue>(
            this ComponentBuilder <MvcBootstrapConfig <TModel>, TTag> builder, Expression <Func <TModel, TValue> > expression, TValue value)
            where TTag : FormButton
        {
            var    config         = (MvcBootstrapConfig <TModel>)builder.GetConfig();
            var    html           = config.GetHtmlHelper();
            var    metadata       = ModelMetadata.FromLambdaExpression(expression, html.ViewData);
            string expressionText = ExpressionHelper.GetExpressionText(expression);
            string name           = GetControlName(html, expressionText);
            string label          = GetControlLabel(metadata, expressionText);

            return(builder
                   .SetName(name)
                   .SetControlLabel(label)
                   .SetValue(value));
        }