 |
| ASP.NET 1.x and 2.0 Application Design Application design with ASP.NET 1.0, 1.1, and 2.0. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP.NET 1.x and 2.0 Application Design section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

February 11th, 2004, 11:38 AM
|
|
Authorized User
|
|
Join Date: Jun 2003
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Msgbox
I'm having trouble using the msgbox function in .net. I get the following error message. It is invalid to show a modal dialog or form when the application is not running in UserInteractive mode. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.
Any help is appreciated.
Thanks
Renee C. Walker
__________________
Renee C. Walker
|
|

February 11th, 2004, 01:00 PM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
You can't use MsgBox in ASP.net. The code is executing on the server. Even if you could use msgbox, when a page request generated a message box, it would pop up on the server not the client's machine. If you want to generate a client-side message box you need to use a javascript alert.
Peter
------------------------------------------------------
Work smarter, not harder.
|
|

February 12th, 2004, 11:17 AM
|
|
Authorized User
|
|
Join Date: Jun 2003
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I'm developing an asp.net application using visual studio .net. Can you tell me how to incorporate the java script alert in my program?
Thanks
Renee C. Walker
|
|

February 12th, 2004, 03:03 PM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
You need to render out some javascript that looks like the following:
<script language="JavaScript">alert("This is my message box text.");</script>
Or you can put the JS function call in the body's onLoad attribute:
<body ... onLoad="alert('Here is another message.');">
Both of these need to go into the HTML markup. If you need to generate one during run-time, you can use .net's RegisterStartupScript() method. With this you need to pass in a complete script block, like the first chunk of code in this post.
Peter
------------------------------------------------------
Work smarter, not harder.
|
|

February 14th, 2004, 04:33 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
|
|
msgbox is for Window app.
in order to have a alertin C# u could use the following code.
Code:
string sWindow As = "mywindow";
string jscript;
jscript = "<script language='JavaScript'>mywindow = window.open('file.aspx','" + sWindow + "','height=350,width=532,toolbars=no,resizable=no')</script>";
RegisterClientScriptBlock("mywindow", jscript);
Always:),
Hovik Melkomian.
|
|

March 16th, 2004, 01:27 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
For VB.NET, instead of MsgBox, you could use MessageBox.Show instead.
|
|

March 16th, 2004, 02:12 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
I'm not sure I understand your post bmains. Is that for ASP.NET or VB.NET forms?
|
|

March 16th, 2004, 03:10 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
VB.NET windows applications also use MessageBox.Show as an alternative to MsgBox; For ASP.NET, you need to do it in a way that planoie has above.
|
|

March 16th, 2004, 03:21 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
Thanks.
I just wanted you to clarify for other readers since Peter already covered that MsgBox was for VB.NET.
It looks confusing, like -here is another way for asp.net users to use it.
|
|

March 16th, 2004, 04:41 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
MessageBox.Show is for windows apps; using JavaScript is for web apps. There's probably another alternative or two, but that will make it even clearer.
|
Similar Threads
|
| Thread |
Thread Starter |
Forum |
Replies |
Last Post |
| Msgbox Help |
darrenb |
Access VBA |
2 |
June 8th, 2007 12:53 AM |
| MsgBox |
prabodh_mishra |
Pro VB 6 |
1 |
December 29th, 2006 11:51 AM |
| msgbox |
Ramakrishna.G |
General .NET |
3 |
September 14th, 2004 02:17 AM |
| help with Msgbox |
helmekki |
Excel VBA |
2 |
June 25th, 2004 08:24 AM |
| msgbox |
bph |
Access VBA |
2 |
February 6th, 2004 03:00 PM |
|
 |