Skip to content

Instantly share code, notes, and snippets.

@timhobbs
Created June 3, 2013 23:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timhobbs/5702256 to your computer and use it in GitHub Desktop.
Save timhobbs/5702256 to your computer and use it in GitHub Desktop.
namespace MySweetApp
{
using System;
using System.Linq.Expressions;
using System.Text;
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc.Html;
public static class FormHelpers
{
public static HtmlString FormField(this HtmlHelper helper, Expression<Func> func)
{
var result = new StringBuilder();
result.Append(@"<div>");
result.Append(helper.LabelFor(func, new { @class = "control-label" }));
result.Append(@"<div>");
result.Append(helper.EditorFor(func));
result.Append(@"</div></div>");
return new HtmlString(result.ToString());
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment