确认信息框 [英] Confirm messege box

查看:167
本文介绍了确认信息框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用



ScriptManager.RegisterStartupScript(此,GetType(),错误,确认('你)从确认消息框中获取返回值只能选择一个批准选项!');,true);



我需要返回值来否决正常情况。如果支票下跌,用户必须能够忽略警告



How do i get the returnvalue from a confirm mesdsage box using

ScriptManager.RegisterStartupScript(this, GetType(), "error", "confirm('You can only choose one approval option!');", true);

I need the return value to overrule the normal conditions. if the check is falls the user has to be able to ignore the warning

if (check == true)
                {
                    InsertReviewers(userArray, groupArray);

                }
                if (check == false)
                {
                  
                    ScriptManager.RegisterStartupScript(this, GetType(), "error", "confirm('You can only choose one approval option!');", true);

// if confirm == true the the method should run, else not!

                        InsertReviewers(userArray, groupArray);

                }

推荐答案

您可以再次从Javascript中捕获结果。例如



ScriptManager.RegisterStartupScript(this,GetType(),error,Check(),true);



然后对于这个块你可以编写如下的Javascript块



You can catch the result from Javascript again. For example

ScriptManager.RegisterStartupScript(this, GetType(), "error", "Check()", true);

And then for this block you can write Javascript block as below

<script type="text/javascript">
        function Check() {
            var result = confirm('You can only choose one approval option!');
            if (result == true) {
                alert('True');
            }
            else {
                alert('False');
            }
        }
    </script>


请参阅ScriptManager.RegisterStartupScript()函数,在执行当前的Server请求后执行javascript。您可以创建一个函数并在此处调用它。您可以从函数返回一个值,并可用于进一步的服务器请求。要对此返回值执行操作。
See, the ScriptManager.RegisterStartupScript() function execute the javascript after executing the current Server request. You can create a function and call it here. You can return a value from the function and can be used to make further server request. To perform the action against this return value.


Page.ClientScript.RegisterStartupScript(this.GetType(), "alert1", "ConfirmBox();", true);


这篇关于确认信息框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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