【发布时间】:2016-12-23 13:15:24
【问题描述】:
网页中的错误消息
在应用程序未运行时显示模式对话框或表单 在 UserInteractive 模式下不是有效的操作。指定 ServiceNotification 或 DefaultDesktopOnly 样式以显示 来自服务应用程序的通知。
我的代码
using System.Windows.Forms;
protected void GridView2_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
var confirmResult = MessageBox.Show("Are you sure to delete thisitem??",
"Confirm Delete!!",
MessageBoxButtons.YesNo);
if (confirmResult == DialogResult.Yes)
{
string terminal_id = GridView2.DataKeys[e.RowIndex].Value.ToString();
selectTerminal();
deleteTerminal(terminal_id);
}
else
{
// If 'No', do something here.
}
}
【问题讨论】:
-
此代码是否在网页中?如果是这样,MessageBox 是 Windows 窗体的一部分,因此将无法在 Web 中使用 - 如果您希望在浏览器中看到它。
标签: c# asp.net .net web-services web