Answers for "call Textboxfor in cs"

C#
0

call Textboxfor in cs

public static class CustomHtmlHelper {

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

        StringBuilder sb = new StringBuilder();
        sb.AppendLine("<div class=\"field-box\">");
        sb.AppendLine("<div class=\"field-box">\");
        sb.AppendLine("<label>{0}</label>", title);
        sb.AppendLine("<div class=\"col-md-7\">");
        sb.AppendLine( htmlHelper.TextBoxFor( expression, new { @class = "form-control inline-input" }) );
        sb.AppendLine("</div>");
        sb.AppendLine( htmlHelper.ValidationMessageFor( expression );
        sb.AppendLine("</div>");
        return new MvcHtmlString( sb.ToString() );
    }

}
Posted by: Guest on April-29-2020

C# Answers by Framework

Browse Popular Code Answers by Language