如何用JavaScript在ASP.NET MVC中实现长尾词的ActionLink生成?
- 内容介绍
- 相关推荐
本文共计204个文字,预计阅读时间需要1分钟。
我正在使用MVC,有一个ActionLink调用我的控制器的Action视图。问题是我想在操作链接的onClick事件上调用JavaScript函数(因为该操作链接转换时的HTML标签标准)。我该如何操作?
我正在使用MVC,我有一个ActionLink调用我的控制器的Action的视图,我的问题是当我想在该操作链接的onClick()事件上调用 javascript函数时(因为该操作链接转换)执行时间的html标准标签).我该怎么办?有什么更好的方法?这是我的ActionLink的代码:
<%=Html.ActionLink("View Report", "GeneratePdf", new { strProductId = myObject.productId})%>
谢谢.
<%=Html.ActionLink("View Report", "GeneratePdf", new { strProductId = myObject.productId}, new { id = "reportLink" } )%> <script type="text/javascript"> $(function() { $('#reportLink').click( function() { ... do what you need to do... // return false; // to cancel the default action of the link }); }); </script>
本文共计204个文字,预计阅读时间需要1分钟。
我正在使用MVC,有一个ActionLink调用我的控制器的Action视图。问题是我想在操作链接的onClick事件上调用JavaScript函数(因为该操作链接转换时的HTML标签标准)。我该如何操作?
我正在使用MVC,我有一个ActionLink调用我的控制器的Action的视图,我的问题是当我想在该操作链接的onClick()事件上调用 javascript函数时(因为该操作链接转换)执行时间的html标准标签).我该怎么办?有什么更好的方法?这是我的ActionLink的代码:
<%=Html.ActionLink("View Report", "GeneratePdf", new { strProductId = myObject.productId})%>
谢谢.
<%=Html.ActionLink("View Report", "GeneratePdf", new { strProductId = myObject.productId}, new { id = "reportLink" } )%> <script type="text/javascript"> $(function() { $('#reportLink').click( function() { ... do what you need to do... // return false; // to cancel the default action of the link }); }); </script>

