• Asp.Net后台弹出确认提示窗Confirm


    前端js代码:

    function MyConfirm(message, guid) {
                if (confirm(message) == true) {
                    document.getElementById("Hidden1").value = guid;
                }
                else {
                    document.getElementById("Hidden1").value = "";
                }
                //form1.submit();
                form1.submit();
            }

    后台C#代码:

     1     /// <summary>
     2     /// 用于标识Confirm是否继续当前操作
     3     /// </summary>
     4     public string ConfirmValue
     5     {
     6         get { return ViewState["ConfirmValue"] == null ? "" : ViewState["ConfirmValue"].ToString(); }
     7         set { ViewState["ConfirmValue"] = value; }
     8     }
     9 
    10  protected void Page_Load(object sender, EventArgs e)
    11     {
    12         if (!string.IsNullOrEmpty(ConfirmValue))
    13         {
    14             btnSave_Click(null, null);//后台弹出确认对话框
    15         }
    16         if (IsPostBack)
    17             {
    18                 return;
    19             }
    20     }
    21 
    22 protected void btnSave_Click(object sender, EventArgs e)
    23     {
    24 
    25 
    26         if (string.IsNullOrEmpty(ConfirmValue))//提示
    27                         {
    28                             string strGuid = Guid.NewGuid().ToString();
    29                             ConfirmValue = strGuid;
    30                             ScriptManager.RegisterStartupScript(this, this.GetType(), "_ShowMessage", "MyConfirm('是否继续?','" + strGuid + "');", true);
    31                             return;
    32                         }
    33                         if (!string.IsNullOrEmpty(ConfirmValue) && ConfirmValue != Hidden1.Value)//取消
    34                         {
    35                             ConfirmValue = "";
    36                             //ShowMessage("提示", "您取消了当前操作");
    37                             return;
    38                         }
    39                         else//如果点击确认,则需要把ConfirmValue初始化为空
    40                         {
    41                             ConfirmValue = "";
    42                         }
    43 }
    44 
    45 
    46 
    47 
    48         
  • 相关阅读:
    IfcBuildingStorey
    IfcBuilding
    IfcSpatialStructureElement (空间结构元素)
    IfcSpatialElement
    IfcProduct
    IfcPropertyDefinition
    IfcObject
    IfcObjectDefinition
    IfcRoot
    IfcTaskTime
  • 原文地址:https://www.cnblogs.com/Mrliang007/p/11407041.html
Copyright © 2020-2023  润新知