简体   繁体   English

如何从ActionLink asp.net Mvc 3调用jquery函数?

[英]How to call jquery function from ActionLink asp.net Mvc 3?

How to call jquery function from actionlink. 如何从actionlink调用jquery函数。 My this.href result : "localhost:54678/Customer?param=1" but i need this.href: "localhost:54678/Customer/EditCustomer/?param=1" Customer is Controller and EditCustomer is Action. 我的this.href结果:“ localhost:54678 / Customer?param = 1”,但我需要this.href:“ localhost:54678 / Customer / EditCustomer /?param = 1”,客户是控制器,EditCustomer是操作。

Jquery: jQuery:



  <%= Html.ActionLink(
             "Click",
             "Index",
    new { param = 1 },
    new { id = "mylink" })
%>

View: 视图:

 <%= Html.ActionLink( "Click", "Index", new { param = 1 }, new { id = "mylink" }) %> 

localhost:54678/Customer/EditCustomer/?param=1 how to call this? 本地主机:54678 / Customer / EditCustomer /?param = 1如何称呼它?

How about this? 这个怎么样?

<%= Html.ActionLink( 
         "Click", 
         "EditCustomer",
new { param = 1 }, 
new { id = "mylink" }) 

%> %>

Your ActionLink is pointing to the Index action of the Customer controller. 您的ActionLink指向“客户”控制器的“索引”操作。 Change it to the EditCustomer like so: 像这样将其更改为EditCustomer:

<%= Html.ActionLink(
             "Click",
             "EditCustomer",
    new { param = 1 },
    new { id = "mylink" })
%>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM