Skip to content

Instantly share code, notes, and snippets.

@jbogard
Created July 25, 2014 13:16
Show Gist options
  • Save jbogard/fb93ff284d0630af99e3 to your computer and use it in GitHub Desktop.
Save jbogard/fb93ff284d0630af99e3 to your computer and use it in GitHub Desktop.
public static HtmlTag InputBlock<T>(this HtmlHelper<T> helper,
Expression<Func<T, object>> expression,
Action<HtmlTag> inputModifier = null,
Action<HtmlTag> validatorModifier = null) where T : class
{
inputModifier = inputModifier ?? (_ => { });
validatorModifier = validatorModifier ?? (_ => { });
var divTag = new HtmlTag("div");
divTag.AddClass("col-md-10");
var inputTag = helper.Input(expression);
inputModifier(inputTag);
var validatorTag = helper.Validator(expression);
validatorModifier(validatorTag);
divTag.Append(inputTag);
divTag.Append(validatorTag);
return divTag;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment