从asp.net服务器端的确认框 [英] Confirmation box from server side in asp.net

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

问题描述

我想告诉从服务器端在asp.net确认框:

I want to show the confirmation box in asp.net from server side:

我想从服务器端调用它,因为我不得不采取从服务器端的客户信息。我使用的是低于code

I want to call it from server side because I have to take the customer message from server side. I am using the below code

    string str = "Are you sure, you want to Approve this Record?";
        ClientScript.RegisterStartupScript(typeof(Page), "Popup", "return confirm('" + str + "');",true);
// More code ....

现在它显示弹出式窗口,不管什么我点击,无论是OK或取消,我的code正在执行。

Now it is showing the popup and irrespective of what I click, whether "ok" or "Cancel", my code is executing.

请让我知道我怎么能限制code被执行时,用户在确认对话框中选择取消。

Please let me know how can I restrict code to be executed when user select "cancel" in the confirmation box.

推荐答案

检查出来:

code背后:

string str = "Are you sure, you want to Approve this Record?";
        this.ClientScript.RegisterStartupScript(typeof(Page), "Popup", "ConfirmApproval('" + str + "');", true);

ASPX:

function ConfirmApproval(objMsg)
    {
        if(confirm(objMsg))
        {
            alert("execute code.");
            return true;
        }    
        else
            return false;    
    }

这篇关于从asp.net服务器端的确认框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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