public static class HtmlHelper
{
/// <summary>
/// 返回没有边框的只读的TextBox标签
/// </summary>
/// <typeparam name="TModel"></typeparam>
/// <typeparam name="TValue"></typeparam>
/// <param name="html"></param>
/// <param name="expression"></param>
/// <returns></returns>
public static MvcHtmlString EditorReadFor<TModel, TValue>(this HtmlHelper<TModel> html, Expression<Func<TModel, TValue>> expression)
{
string format = null;
object htmlAttributes = new
{
@readonly = "readonly",
@style = "border:none"
};
return html.TextBoxFor(expression, format, htmlAttributes);
}
}