472,353 Members | 1,958 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,353 software developers and data experts.

Message(box) on webform

How do I get a message(box) on a webform like msgbox(text,typeof
messagebox,Title)
Heres my code from the vs-help.
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
Dim msg As String
Dim title As String
Dim style As MsgBoxStyle
Dim response As MsgBoxResult
msg = "Do you want to continue?" ' Define message.
style = MsgBoxStyle.DefaultButton2 Or _
MsgBoxStyle.Critical Or MsgBoxStyle.YesNo
title = "MsgBox Demonstration" ' Define title.
' Display message.
response = MsgBox(msg, style, title)
If response = MsgBoxResult.Yes Then ' User chose Yes.
' Perform some action.
Else
' Perform some other action.
End If
End Sub

I get the error-message 'It is not legal to show a modal daialogbox or a
modal form ... (translated from norwegian)

regards

reidarT

Nov 21 '05 #1
10 7253
"ReidarT" <re****@eivon.no> schrieb:
How do I get a message(box) on a webform like msgbox(text,typeof
messagebox,Title)

Either use a client-side VBScript ('MsgBox') or JScript ('alert').

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Nov 21 '05 #2
I have seen this question asked in a few forums over the past few months.
One forum is http://www.gotdotnet.com & a Microsoft Developer says that it
isn't possible.

On another few forums the same conclusion of the members was found.

The way Herfried is suggesting is a 'popup' box not a 'message box'.

Crouchie1998
BA (HONS) MCP MCSE
Nov 21 '05 #3
> I get the error-message 'It is not legal to show a modal daialogbox or a
modal form ... (translated from norwegian)


Ohh, not an easy answer I'm afraid. It's surprisingly hard as you often want
to show a message box in response to a button click. This button click is
most probably handled by the server side click event. But your "check" code
is now running on the server, not on the client. So you have to post back
the page with some kind of flag/message set-up so that the client side code
can then popup a normally hidden DHTML user control.

The way we do it something along these lines:

o Create a user control that's a simple frame with a textbox and the command
buttons inside
o This is placed inside a DIV on the page and normally hidden via
Style.Visibility="False"
o When the popup message is required, a store the message in the session
cache (in effect) and let the post back carry on to the same form
o In Page_Load, it checks the session cache for the message, sets the DIV to
visible and positions in the middle
o The message is then cleared from the session cache so that it doesn't
appear next post back

We use a bit of JavaScript to hide/show the box. I can't remember quite why
we do this client side as I'm sure we could do it server side.

There are many other ways as well. All of above is from memory :-)

The simple "MsgBox" requirement is one of the most single simplest items
that doesn't have highlight the difference in architecture of standard
client apps to web apps...

Cheers, Rob.
Nov 21 '05 #4
"Crouchie1998" <cr**********@spamcop.net> schrieb:
The way Herfried is suggesting is a 'popup' box not a 'message box'.


Microsoft uses the term "message box" to refer to these windows:

JScript .NET -- Using Message Boxes
<URL:http://msdn.microsoft.com/library/en-us/jscript7/html/jsUsingMessageBoxes.asp>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #5
> The way Herfried is suggesting is a 'popup' box not a 'message box'.
Gee, that's really helpful there, Mr. Precison. But, if accuracy is your
true goal, it's 'Message Box' not 'message box'.

Also, Google returns more relevant results using 'Message Box' than it does
with 'popup' box.

Bob Lehmann

"Crouchie1998" <cr**********@spamcop.net> wrote in message
news:uE*************@TK2MSFTNGP09.phx.gbl...
I have seen this question asked in a few forums over the past few months.
One forum is http://www.gotdotnet.com & a Microsoft Developer says that it
isn't possible.

On another few forums the same conclusion of the members was found.

The way Herfried is suggesting is a 'popup' box not a 'message box'.

Crouchie1998
BA (HONS) MCP MCSE

Nov 21 '05 #6
Reidar,

In this message is a simple (not optimized) sample that I made for a client
side messagebox. That is done in VBNet code.

http://groups-beta.google.com/group/...3be52415?hl=en

I hope this helps,

Cor
Nov 21 '05 #7
Crouchie,
I have seen this question asked in a few forums over the past few months.
One forum is http://www.gotdotnet.com & a Microsoft Developer says that it
isn't possible.

On another few forums the same conclusion of the members was found.


Any reasons that you trust the members from this newsgroup less?

(See my answer to Reidar)

Cor

Nov 21 '05 #8

Hello reidar

go to http://www.tireponline.de
in the logon box enter a dummy name and password press the "login" button

and see the response

if this or something simular is what you want then i can help you as i am
the sole developer of this website

By the way the used technique on that website will work on every client (
Mozilla and IE , Windows and Linux ) as this hole website is platform
independent
well if this is what you need reply

Michel Posseth [MCP]


"ReidarT" <re****@eivon.no> wrote in message
news:e%******************@TK2MSFTNGP10.phx.gbl...
How do I get a message(box) on a webform like msgbox(text,typeof
messagebox,Title)
Heres my code from the vs-help.
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
Dim msg As String
Dim title As String
Dim style As MsgBoxStyle
Dim response As MsgBoxResult
msg = "Do you want to continue?" ' Define message.
style = MsgBoxStyle.DefaultButton2 Or _
MsgBoxStyle.Critical Or MsgBoxStyle.YesNo
title = "MsgBox Demonstration" ' Define title.
' Display message.
response = MsgBox(msg, style, title)
If response = MsgBoxResult.Yes Then ' User chose Yes.
' Perform some action.
Else
' Perform some other action.
End If
End Sub

I get the error-message 'It is not legal to show a modal daialogbox or a
modal form ... (translated from norwegian)

regards

reidarT


Nov 21 '05 #9
Reidar,

I see now that there is a texbox in this sample.

I used this textbox to transfer the answer from the prompt to the
serverside.

That has nothing to do with the messagebox itself.

That and the way the prompt is showed is the part where I mean that there
can be a lot improved. However the "how" is completly in this sample.

Cor
Nov 21 '05 #10
Hope this is what you asking for.

private void Status(string msg)
{
//MessageBox Script
String scriptString = "<script language=JavaScript>";
scriptString += "alert('" + msg + "');";
scriptString += "</script>";
//if(!this.IsStartupScriptRegistered("MessageBox"))
Page.RegisterStartupScript("ShowMessage", scriptString);
}

*** Sent via Developersdex http://www.developersdex.com ***
Nov 21 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: bev | last post by:
I have been developing a .net web application and have come across a road block within my expertise. .net is the first web language I have used. ...
4
by: meganrobertson22 | last post by:
Hello everyone- I have a combo box, and I want to know if it is possible to have some sort of Message Box pop-up if a certain value is selected...
2
by: Anil | last post by:
iam getting too many messages boxes when i include a message box in a KeyUP eventhanler function which in turn have validation if functio my code i...
0
by: Newbie | last post by:
i have a c# asp.net webform wherein i'm using requiredfieldvalidator and regularexpressionvalidator controls to validate the textboxes. i have a...
2
by: Mike Moore | last post by:
asp.net app - How do you get Java-side code to communicate with server-side code? I have tried numerous ways and examples, but have been...
2
by: Microsoft News | last post by:
What I have is a message box that pops up. It is another browser window. The code is a general function that you pass message, title and a key to....
8
by: chuckdfoster | last post by:
Hello Everyone, I am trying to prompt the user for something. I don't think that I can use a message box from ASP.NET. I have tried using...
3
by: Shelly | last post by:
I want to do something like bringing up a message box in Java where after clicking OK the box disappears and processing continues. How do I do...
6
by: Rudy | last post by:
Hello all! I'm working in vb/ado.net I want to to have a message box pop up based on a result of a update on a SQL table. How do I do that so...
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.