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



如何从actionlink调用jquery函数。我的this.href结果:"localhost:54678/Customer?param=1"但我需要这个.href:"localhost:54678/Customer/EditCustomer/?param=1"Customer是Controller,EditCustomer是Action。

Jquery:

  $('#mylink').click(function (e) {
            jQuery('#dialog').dialog('open');
            var iframe = $('#frame');
            alert(this.href);
            $(iframe).attr('src', this.href);
            e.preventDefault();
        });

视图:


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

localhost:54678/Customer/EditCustomer/?param=1如何调用?

这个怎么样?

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

%>

ActionLink指向Customer控制器的Index操作。将其更改为EditCustomer,如下所示:

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

最新更新