首先我们要封装一个自定义的类:

View Code
1  public static class HtmlHelper
2     {
3         //Ajax.ActionLink 添加个图片链接
4         public static IHtmlString WriteHtml(this MvcHtmlString str) 
5         {
6             return new HtmlString(HttpUtility.HtmlDecode(str.ToString()));
7         }
8     }


然后 在连接出调用WriteHtml()方法即可

视图代码如下:

View Code
1 @Ajax.ActionLink("<img src='http://www.cnblogs.com/image/q.gif' />", "Index","One", new AjaxOptions { UpdateTargetId = "Myn", Confirm = "确定" }).WriteHtml()

 如果是使用@Html.ActionLink()的话,和@Ajax.ActionLink()是一样使用的,都是调用WriteHtml()方法即可

相关文章:

  • 2021-07-25
  • 2021-10-29
  • 2022-12-23
  • 2022-12-23
  • 2021-10-13
  • 2022-12-23
  • 2021-08-23
  • 2021-11-21
猜你喜欢
  • 2022-12-23
  • 2021-12-13
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-02
  • 2022-12-23
相关资源
相似解决方案