如何停止我的确认框弹出窗口。 [英] How Can I Stop My Confirm Box Popup.

查看:118
本文介绍了如何停止我的确认框弹出窗口。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

方法跟随:

实际上,删除列表视图中的一些数据。我正在通过ajax调用

并查找一些数据从DataBase关于那个id.And在Popup上显示数据。

现在如果用户OK,那么它应该通过item命令执行动作,否则不行。



问题:

确认弹出窗口会自动隐藏自己。并自动进入行命令。



Approach Followed:
Actually,for deleting some data present in List View.I am going through ajax call
and finding some data from DataBase with respect to that id.And showing that data on Popup.
Now if user OK then it should perform the action through item command otherwise not.

Problem:
Confirm Popup is automatically hiding itself.And automatically it goes on Row Command.

function RemindersCount(Type, ActivityId) {
      $.ajax({
          url: "AddProduct.aspx/RemindersActive",
          type: "POST",
          contentType: "application/json;charset=utf-8",
          dataType: "json",
          data: "{ Type:'" + Type + "',  ActivityId:'" + ActivityId + "' }",
          cache: false,
          success: function (data) {
              var obj = JSON.parse(data.d);
              var action = confirm('If you delete the Activity.Your ' + obj.ActiveCount + ' active Reminders will also be deleted.');

              if (action) {


                  return true;
              }
              else {

                  return false;
              }
          },
          error: function (ex) {
              return false;
          }
      });
  }



上面的ajax函数由列表视图中的LinkBut​​ton调用。


The above ajax function is called By LinkButton present in List View.

<asp:LinkButton ID="lnkRemoveOpenActivity" OnClientClick='<%# string.Format("return RemindersCount(\"{0}\",\"{1}\");", Eval("Source"),Eval("RecordId")) %>'
    CommandName="RemoveFollowUp" CommandArgument='<%# Eval("RecordId")%>' runat="server"
    ToolTip="Remove" CssClass="temp"></asp:LinkButton>

推荐答案

.ajax({
url:AddProduct.aspx / RemindersActive,
类型:POST,
contentType:application / json; charset = utf-8,
dataType:json,
data:{Type:'+ Type + ',ActivityId:'+ ActivityId +'},
cache:false,
success:function(data){
var obj = JSON.parse(data.d);
var action = confirm('如果你删除了Activity.Your'+ obj.ActiveCount +'活跃的提醒也将被删除。');

if(action){


返回true;
}
else {

返回false;
}
},
错误: function(ex){
return false;
}
});
}
.ajax({ url: "AddProduct.aspx/RemindersActive", type: "POST", contentType: "application/json;charset=utf-8", dataType: "json", data: "{ Type:'" + Type + "', ActivityId:'" + ActivityId + "' }", cache: false, success: function (data) { var obj = JSON.parse(data.d); var action = confirm('If you delete the Activity.Your ' + obj.ActiveCount + ' active Reminders will also be deleted.'); if (action) { return true; } else { return false; } }, error: function (ex) { return false; } }); }



上面的ajax函数由列表视图中的LinkBut​​ton调用。


The above ajax function is called By LinkButton present in List View.

<asp:LinkButton ID="lnkRemoveOpenActivity" OnClientClick='<%# string.Format("return RemindersCount(\"{0}\",\"{1}\");", Eval("Source"),Eval("RecordId")) %>'
    CommandName="RemoveFollowUp" CommandArgument='<%# Eval("RecordId")%>' runat="server"
    ToolTip="Remove" CssClass="temp"></asp:LinkButton>


我会建议如下。不要使用确认。不仅这种对话不灵活;它们很难看,不方便,几乎不适合生产级的场地。更好的想法是使用所谓的模态弹出方法。请参阅我的文章,其中我解释了它们如何工作,如何创建自己的工作,并讨论替代方案,包括确认和其他本机JavaScript对话框:

从零开始的模态弹出窗口 [ ^ ]。



模式弹出窗口最流行的实现是jQuery Dialog 和许多第三方jQuery 插件

对话框| jQuery UI [ ^ ],

< a href =http://bfy.tw/Vdm>让我谷歌为你 [ ^ ]。



-SA
I would advise the following. Don't use confirm. Not only such dialogs are not flexible; they are ugly, inconvenient and hardly can be suitable for production-grade sites. Much better idea is using so called modal popup approach. Please see my article where I explain how they work, how you can create your own one, and discuss the alternatives, including confirm and other native JavaScript dialogs:
Modal Popup From Scratch[^].

Most popular implementation of modal popup is jQuery Dialog and many 3rd-party jQuery plug-ins:
Dialog | jQuery UI[^],
Let me google that for you[^].

—SA


这篇关于如何停止我的确认框弹出窗口。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆