一.先创建一个HtmlHelper的扩展类,代码: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; namespace Practice.Helper { public static class MvcHelper { public static string SayHello(this HtmlHelper htmlHelper,…
先看示例代码: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using System.Web.Routing; namespace MvcApplicationWeb { public static class HtmlExtensions { public static MvcHtmlString TestHtml(this…
代码: using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Web; using System.Web.Mvc; using System.Web.Routing; using System.Web.UI; namespace System.Web.Mvc.Html { public static class HtmlExten…