【问题标题】:How to call jquery function from ActionLink asp.net Mvc 3?如何从 ActionLink asp.net Mvc 3 调用 jquery 函数?
【发布时间】:2012-08-23 11:16:45
【问题描述】:

如何从 actionlink 调用 jquery 函数。我的 this.href 结果: "localhost:54678/Customer?param=1" 但我需要 this.href: “本地主机:54678/Customer/EditCustomer/?param=1” 客户是控制器,EditCustomer 是操作。

查询:

  $('#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 这个怎么调用?

【问题讨论】:

    标签: c# jquery asp.net-mvc asp.net-mvc-3 jquery-ui


    【解决方案1】:

    这个怎么样?

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

    %>

    【讨论】:

      【解决方案2】:

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

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2013-04-21
        • 1970-01-01
        • 1970-01-01
        • 2017-03-30
        • 1970-01-01
        • 2011-08-18
        • 1970-01-01
        • 2015-09-26
        相关资源
        最近更新 更多