【问题标题】:message in webFrom c#web中的消息来自c#
【发布时间】: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


【解决方案1】:

var confirmResult = MessageBox.Show("你确定要删除这个项目吗??", “确认删除!!”, MessageBoxButtons.YesNo, MessageBoxIcon.None);

尝试使用这个:)

【讨论】:

  • 问题是关于ASP .NET WEB FORMS 而不是Windows Forms
猜你喜欢
  • 2018-02-18
  • 2016-10-29
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多