gpt4 book ai didi

asp.net-mvc-ajax - 为Ajax Action链接添加CSS类

转载 作者:行者123 更新时间:2023-12-04 13:34:25 33 4
gpt4 key购买 nike

如何为Ajax.ActionLink添加类?

@Ajax.ActionLink("Remove this photo","RemovePhoto","Admin",new{Id=Model.filename, @class="ActionClass"},new AjaxOptions{OnSuccess = "RemoveSuccess"})

但是此方法不会为此ActionLink创建CSS类。
我的类(class)已添加到网址中:
AdminTools/RemovePhoto/ffff.JPG?class = RemovePhoto

最佳答案

您可以为此使用(AjaxHelper, String, String, Object, AjaxOptions, Object)方法签名。

public static MvcHtmlString ActionLink(
this AjaxHelper ajaxHelper,
string linkText,
string actionName,
Object routeValues,
AjaxOptions ajaxOptions,
Object htmlAttributes
)

如您所见,最后一个参数是HTML属性的集合。

资料来源: http://msdn.microsoft.com/en-us/library/dd470546.aspx

关于asp.net-mvc-ajax - 为Ajax Action链接添加CSS类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7364158/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com