gpt4 book ai didi

c# - asp.net弹出确认窗口

转载 作者:太空宇宙 更新时间:2023-11-03 18:13:15 24 4
gpt4 key购买 nike

我需要在“删除”按钮上添加一个“您确定”弹出窗口,并且不确定用户单击“确定”还是“取消”如何获取。

这是我的方法:

string message = "Are you sure you want to delete this user?";
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append("return confirm('");
sb.Append(message);
sb.Append("');");
Type type = this.GetType();
ClientScript.RegisterOnSubmitStatement(type, "alert", sb.ToString());

最佳答案

您可以将按钮上的OnClientClick设置为:

return confirm("Are you sure you want to delete this user?");


如果用户未单击“确定”,则不会发生提交/回发。

关于c# - asp.net弹出确认窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10863141/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com