【问题标题】:Jquery call on edit button click in mvc grid在 mvc 网格中单击编辑按钮的 Jquery 调用
【发布时间】:2016-05-13 12:23:37
【问题描述】:

下面是网格列

 grid1.Column("", header: "Edit", format: @<text>@Html.ActionLink("Edit", "EditEmployee", "BootStrap", new { id = item.empId }, new { target = "_blank" })</text>)

如果我点击上方的编辑按钮,我想编写 jquery 函数以在 div 下方打开

<div id="editView">
    @Html.Partial("~/Views/BootStrap/EditEmployee.cshtml",new EmployeeModel.Employee2())
</div>

【问题讨论】:

    标签: jquery asp.net-mvc


    【解决方案1】:

    试试这个:

    grid1.Column("", header: "Edit", format: @<text>@Html.ActionLink("Edit", "EditEmployee", "BootStrap", new { id = item.empId }, new { target = "_blank", id = "myBtn" })</text>)
    

    JS:

    $("#myBtn").click(function(){
        $("#editView").show() //or open in dialog, or I don't know.
    })
    

    【讨论】:

      【解决方案2】:

      试试这个

      grid1.Column("", header: "Edit", format: @<text>@Html.ActionLink("Edit", "EditEmployee", "BootStrap", new { id = item.empId,@onClick="EditEmployee()" }, new { target = "_blank" })</text>)
      

      jQuery 函数

      function EditEmployee()
        {
         $("#editView").show();
        }
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2021-01-03
        • 2018-07-27
        • 2015-12-06
        • 1970-01-01
        • 2021-03-27
        • 1970-01-01
        • 2014-01-09
        • 1970-01-01
        相关资源
        最近更新 更多