Wrox Programmer Forums
|
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional 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
 
Old May 31st, 2007, 08:10 AM
Authorized User
 
Join Date: May 2007
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default MsgBox problem in ASP.NET

Hi friends

I have used MsgBox in one of ASP.NET application.
When I compile and run the application in editor the msgbox works finely.
But after uploading the site/application on the server, it goes to error page ( which shows server-error)..
so i am not getting how should i use msgbox in asp.net application.

Please reply me.

Thanking You with Regards

AMOL

Amol Chikurte
__________________
Amol Chikurte
 
Old May 31st, 2007, 05:10 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

You can not use a message box in a web application. The code is running on the server, the application is viewed thru the client browser. If you *could* launch a message box only someone sitting at the server console would see it. The user viewing thru the browser will not see it.

The error you get when you try to do this when it's running on IIS is "Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation..."

It works when you are developing because the web server you are using (built-in development web server) IS running in UserInteractive mode. It's running on your desktop in the system task tray. This leads to the false perseption that you can legally do this with a web application.

You need to use client side script if you want to present the user with a messagebox-like interface. This is accomplished with the javascript "alert()" method. You can emit this javascript to the browser "on-demand" with server-side that looks like this:

Page.ClientScript.RegisterStartupScript(this.GetTy pe(), "MyMessageBoxScript", "alert('Hello World');", true);

This will emit the script to the client after the postback and the browser will execute it after the page is loaded, showing the alert dialog.

-Peter
 
Old June 1st, 2007, 01:04 AM
Authorized User
 
Join Date: May 2007
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks & Thanks a lot Peter..

It's really working fine.

Actually it is very much necessary for me, but i don't know is it really a standard way or not.
But anyways thanks again to help me out.

with Regards

-Amol

Amol Chikurte





Similar Threads
Thread Thread Starter Forum Replies Last Post
JavaScript OK/Cancel msgbox in ASP.Net LenexaKS ASP.NET 1.0 and 1.1 Professional 3 February 5th, 2007 03:06 PM
Msgbox Function Problem theokrtz Classic ASP Basics 4 July 4th, 2006 03:35 AM
Problem with Exercise in Beg. asp.net for VB.net! mrfella71 BOOK: Beginning ASP.NET 1.0 1 October 23rd, 2005 12:06 PM
MsgBox in asp crmpicco Classic ASP Basics 2 June 24th, 2005 08:37 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.