是或否MessageBox
如何在删除记录之前显示确认消息框? 按钮应为YES
或NO
。 不行或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/