【问题标题】:HtmlHelper to display only a few charactersHtmlHelper 只显示几个字符
【发布时间】:2014-03-14 19:49:18
【问题描述】:

是否可以使用 HtmlHelper 仅显示文本的几个字符?我该怎么做?

【问题讨论】:

    标签: asp.net-mvc nhibernate html-helper spark-view-engine


    【解决方案1】:

    这样的?

    public static MvcHtmlString SubString(this HtmlHelper helper, string theString, int length)
    {
      return MvcHtmlString.Create(theString.Substring(0,length));
    }
    

    【讨论】:

      猜你喜欢
      • 2022-08-15
      • 2022-01-15
      • 1970-01-01
      • 2016-07-01
      • 2011-03-25
      • 1970-01-01
      • 1970-01-01
      • 2017-01-30
      • 1970-01-01
      相关资源
      最近更新 更多