0

单击删除时正在使用页面,它将打开弹出窗口并要求确认,现在我想在单击取消时关闭弹出窗口但不重定向到主页。下面的代码是 mvc 中的删除视图...

@using (Html.BeginForm()) {
<p>
    <input type="submit" value="OK" /> 
   @Html.ActionLink("Back to List", "Index")

jQuery代码是

$(".deleteimage").click(function (e) {
        var url = $(this).parent().attr('href');
        $("#dialog-delete").dialog({
            resizable: false,
            height: 180,
            width: 300,
            show: { effect: 'drop', direction: "up" },
            modal: true,
            draggable: false,
            open: function (event, ui) {
                $(this).load(url);
            },
            close: function (event, ui) {
                $(this).dialog('close');
            }
        });
        $("#dialog-delete").dialog('open');

        return false;
    });

在索引视图中我正在使用此代码..

  @(new HtmlString(@Ajax.ImageActionLink("../../Content/images/grid/Del.png", "Delete", "Delete", "Delete", new { id = item.TerminalID }, "deleteimage", new AjaxOptions
         {
             HttpMethod = "GET",
             InsertionMode = InsertionMode.Replace,
             UpdateTargetId = "targetdiv"
       }))) 
4

1 回答 1

1

为了关闭一个 jQuery UI 对话框,你可以使用 close 方法:

$("#dialog-delete").dialog('close');
于 2013-06-22T10:11:48.753 回答