473,500 Members | 1,967 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 7331
"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
5236
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. I have found that I need java script to do some...
4
5626
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 in the combo box. For example, I have a combo...
2
4231
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 when i press the ok button of the message box ,...
0
453
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 button "Close" that should work like this: When the...
2
3713
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 unsuccessful. Therefore, unless I get real lucky and find...
2
3274
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. The box works great except, that if you are on a...
8
5178
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 VBScript to give the message box, but I can't figure...
3
2832
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 this in PHP? I want the processing after the...
6
1352
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 it automaticly pops up after the update is...
0
7182
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7232
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6906
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7397
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5490
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4611
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1430
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
672
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
316
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.