Created
July 21, 2014 22:26
-
-
Save mxmissile/6a59527890e4be3d9213 to your computer and use it in GitHub Desktop.
@Html.LabelWithInput(...)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static HtmlTag LabelWithInput<T>(this HtmlHelper<T> helper, Expression<Func<T, object>> expression) where T : class | |
{ | |
var generator = GetGenerator<T>(); | |
var label = generator.LabelFor(expression, model: helper.ViewData.Model); | |
var input = generator.InputFor(expression, model: helper.ViewData.Model); | |
var div = new DivTag(); | |
div.AddClass("form-group"); | |
div.Append(label); | |
div.Append(input); | |
return div; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment