English 中文(简体)
背 景
原标题:confirm message box
  • 时间:2009-10-21 20:21:58
  •  标签:

我有一个避风港,在被点击时,应当对数据库作一些改动。

if (bFound== false)
{
   // Giving the warning message
   // If user presses cancel then abort

   // Prepare the list of dbId needs to be deleted
   deletedBSIds.Add(dbId);
}

在这里,如果“条码”/代号”领域是真实的,那么它就不应执行上述声明,但如果是假的,它就应当符合条件,然后询问用户是否希望节省“或”改动。

如果用户说是的话,应当去“deletedBSIds.Add(dbId);,并继续执行,但用户须报 它绝不应ort,也绝不应.。

Is there a way to do this? Any help would be appreciated.

这是一个服务器附带活动。 因此,我认为不能在我的纽伦加点。

这里的电文箱如果是假的,就只会消失。 否则,它根本不会消失。

如果我感到错的话,请予以纠正。

感谢

问题回答

请在纽伦加添以下内容:

button.OnClientClick = "return ConfirmThis();";

然后,需要增加公司。 本职能如下:

Page.ClientScript.RegisterScriptBlock(GetType(), "ConfirmThis", 
    @"function ConfirmThis() {
         if(condition) { //where condition checks the bfound element.
             return confirm(""Are you sure you want to delete this?"");
         }
         return true;
      }");

采取这种做法,你会再次试图尝试,并能够测试 j版中客户一方的found状态。 如果<代码>bfound 价值储存在<条码>文本箱或<条码>上。 如果<代码>bfound 当你创建该网页时,你可以将其注入<代码>。 直接通过<代码> 1. 确认作为参数发挥作用。

Edit in response to your edit:

在试图从用户那里获得确认时,你有两个选择:

  1. Using client side logic that is already sent to the browser to perform the confirm. This is the example that I have given above.
  2. The "Other" option is to send the page back with a modal dialog, or using the confirm box. You will then get the user s confirmation back in a completely new postback to the server. So you ll need to rethink your logic to be able to temporarily store the information from the first post back and wait for the second post back to finalize the desired action.

在这两个例子中,第一种选择是清洁的,不需要临时记忆,使用户不必再加回。

由于这两种选择都要求你重订要求确认书的逻辑,如果我尽可能试图改变显示确认方言所需的逻辑,以便能够在客户的计算机上用javascript进行。

www.un.org/Depts/DGACM/index_spanish.htm 是否有任何办法可以预先计算成像变数,或至少向客户发送足够的信息。

If you still feel like using option 2 after all of my pleading:

使用以下代码(基于 http://www.dotnetspider.com/resources/1521-How-quest-Postback- from-Javascript.aspx:

if(bfound)
{
    //save all the information you need in temporary information
    ViewState["InformationINeedToFinishAfterPostback"] = ImportantInformation;

    Page.ClientScript.RegisterScriptBlock(GetType(), "postbackmethod", Page.ClientScript.GetPostBackEventReference(this, "MyCustomArgument"));
    Page.ClientScript.RegisterStartupScript(GetType(), "startupconfirm", 
        @"if(confirm(""are you sure?"") {
              __doPostBack( __Page ,  MyCustomArgument );
          }");
}

现在处理背后问题,在您的网页上添加以下代码:

if(Request("__EVENTARGUMENT") == "MyCustomArgument")
{
    ImportantInformation = (CastToAppropriateType)ViewState["InformationINeedToFinishAfterPostback"];
    //finalize the desired action here.
}

<><>But> 我仍建议第一个选择。 但是,现在,你需要两种选择。 此外,我也试过这一守则,因此,你不得不面对同学问题,但你却走上正轨。

我并不全心全意地确定应该代表什么,但你可以通过某些服务器代码执行1/2,然后回到客户-伙伴关系。 该网络没有这样做。

典型的情况是,你将与一些客户方 Java成文一道确认。 页: 1 是/否确认寻找多种不同方式这样做......

一旦你完成这项工作,你就可以有条件地实施服务器边代码。

http://www.google.co.uk/search?q=javascript+confirm&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-GB: official&client=firefox-a” rel=“nofollow noretinger”>confirm(功能,向用户显示与OK和Cancels的方言词。 然后,你可以把用户的选择储存在一个隐蔽的领域中,并引发后退。 http://msdn.microsoft.com/en-us/library/a479390.aspx”rel=“nofollow noreferer”>article 说明如何使用协会向客户提供 Java印码。 NET。

由于你正在使用协会。 NET 你可以补充一下子子:

 btnDelete.Attributes.Add("onclick", "return confirm( Are you sure? );");

btnDelete 是你的布顿。





相关问题
热门标签