Csharp/C#教程:是或否MessageBox分享


是或否MessageBox

如何在删除记录之前显示确认消息框? 按钮应为YESNO 。 不行或CANCEL 。 我有这个代码,但它只适用于c#winforms …

 if (MessageBox.Show("Delete record no. " + numID.Text + "?", "Confirm User Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { //codes to delete records } 

如果您正在显示此客户端,那么您应该使用Javascript。 一个好方法是使用jQuery 对话框方法。 例如:

标记:

 
This is the content

使用Javascript:

  $( "#dialog-confirm" ).dialog({ resizable: false, height:280, modal: true, buttons: { "Yes": function() { $( this ).dialog( "close" ); }, "No": function() { $( this ).dialog( "close" ); } } }); 

小提琴: http : //jsfiddle.net/ghLpV/

       

检查此链接:

https://aspsnippets.com/Articles/Server-Side-Code-Behind-Yes-No-Confirmation-Message-Box-in-ASPNet.aspx

上述就是C#学习教程:是或否MessageBox分享的全部内容,如果对大家有所用处且需要了解更多关于C#学习教程,希望大家多多关注—计算机技术网(www.ctvol.com)!

本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。

ctvol管理联系方式QQ:251552304

本文章地址:https://www.ctvol.com/cdevelopment/954758.html

(0)
上一篇 2021年11月20日
下一篇 2021年11月20日

精彩推荐