public static ComponentBuilder <MvcBootstrapConfig <TModel>, CheckedControl> CheckBoxFor <TComponent, TModel, TValue>( this BootstrapHelper <MvcBootstrapConfig <TModel>, TComponent> helper, Expression <Func <TModel, TValue> > expression, bool isNameInLabel = true) where TComponent : Component, ICanCreate <CheckedControl> { ModelMetadata metadata = ModelMetadata.FromLambdaExpression(expression, helper.GetConfig().HtmlHelper.ViewData); string expressionText = ExpressionHelper.GetExpressionText(expression); string name = GetControlName(helper, expressionText); string label = GetControlLabel(metadata, expressionText); bool isChecked = false; if (metadata.Model == null || !bool.TryParse(metadata.Model.ToString(), out isChecked)) { isChecked = false; } return(isNameInLabel ? helper.CheckBox(name, label, null, isChecked) : helper.CheckBox(name, null, label, isChecked)); }