当应用程序不在UserInteractive模式下运行时,显示模式对话框或窗体是无效操作.指定ServiceNotification或DefaultDesktopOnly样式以显示... [英] Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a...

查看:89
本文介绍了当应用程序不在UserInteractive模式下运行时,显示模式对话框或窗体是无效操作.指定ServiceNotification或DefaultDesktopOnly样式以显示...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经将Web应用程序托管在计算机的iis上.在我的页面上,myy gridview中有一个删除按钮.当我单击Delete时,我需要确认消息,所以我编写了此代码.但是不幸的是,我在这里遇到此错误.解决我的错误的方法是什么.请帮助我的朋友..

I have hosted my web application on iis in my machine.In my page i have a delet button in myy gridview.When i click delete i needed a confirmation message,so i wrote this code.But unfortunately i get this error here. what is the solution for my error.help me friends..

protected void DeleteRecord(object sender, GridViewDeleteEventArgs e)
   {
       if (!IsPageRefresh)
       {
           string id = gridRegistrationTableDetails.Rows[e.RowIndex].Cells[2].Text;
           if (MessageBox.Show("Are you sure to delete the record?", "Delete Employee Record.!", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
           {
               deleterecordMethod(id);
               BindData();
           }
       }
   }


请为我发布此解决方案...


Pls post me solution for this...

推荐答案

MessageBox用于Windows(与Web相对)应用程序.它将尝试在服务器上打开一个消息框.不允许这样做,这样会导致应用程序错误.

要在客户端上显示一条消息,您需要使用JavaScript-例如alert("message").

查看此讨论,希望它能解决您的问题:
http://forums.asp.net/t/907491.aspx/1 [ ^ ]
http://stackoverflow.com/questions/1030891/error- while-showing-a-modal-dialog-box-or-form [
MessageBox is for use within windows (as opposed to web) applications. It would attempt to open a message box on the server. This is not allowed so that application errors.

To show a message on the client you would need to use JavaScript - such as alert("message").

Check this discussion, hope it solves your issue:
http://forums.asp.net/t/907491.aspx/1[^]
http://stackoverflow.com/questions/1030891/error-while-showing-a-modal-dialog-box-or-form[^]


这篇关于当应用程序不在UserInteractive模式下运行时,显示模式对话框或窗体是无效操作.指定ServiceNotification或DefaultDesktopOnly样式以显示...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆