call Textboxfor in cs code example

Example: call Textboxfor in cs

public static class CustomHtmlHelper {

    public static MvcHtmlString MyFieldBox(this HtmlHelper html, Expression> expression, String title) {

        StringBuilder sb = new StringBuilder();
        sb.AppendLine("
"); sb.AppendLine("
\"); sb.AppendLine("", title); sb.AppendLine("
"); sb.AppendLine( htmlHelper.TextBoxFor( expression, new { @class = "form-control inline-input" }) ); sb.AppendLine("
"); sb.AppendLine( htmlHelper.ValidationMessageFor( expression ); sb.AppendLine("
"); return new MvcHtmlString( sb.ToString() ); } }

Tags:

Misc Example