Click here to Skip to main content
15,912,897 members
Home / Discussions / Web Development
   

Web Development

 
GeneralRe: Building XML files from scratch Pin
Stan Shannon2-Feb-02 14:52
Stan Shannon2-Feb-02 14:52 
GeneralSorting in DataGrid Pin
omkamal30-Jan-02 11:12
omkamal30-Jan-02 11:12 
GeneralRe: Sorting in DataGrid Pin
omkamal4-Feb-02 10:23
omkamal4-Feb-02 10:23 
QuestionMaking a new line? Pin
30-Jan-02 8:05
suss30-Jan-02 8:05 
AnswerRe: Making a new line? Pin
Jon Sagara30-Jan-02 8:36
Jon Sagara30-Jan-02 8:36 
GeneralRe: Making a new line? Pin
30-Jan-02 11:50
suss30-Jan-02 11:50 
GeneralMessage Boxes Pin
Wildcard29-Jan-02 16:16
Wildcard29-Jan-02 16:16 
GeneralRe: Message Boxes Pin
Paul Watson29-Jan-02 23:10
sitebuilderPaul Watson29-Jan-02 23:10 
Wildcard wrote:
Sorry Im new to programming I have built a few apps in VB and probe but I'm having a problem making popup boxes in asp.net. I can use Java S but I'm trying to have a popup message dependant on IF statement based on checklist selections and can't figure it out. Can anyone help

Ahh yes, I too butted my head against the stupidty (which I soon realised was mine) of this problem.

Basically, and I don't have a lot to go on here so correct me if I am wrong, you are trying to use a messagebox() method like you would in VB, but here you are trying to do it on a web page based on an if statement?

You can do it if you use VBScript as your client side language. But that is not recommended as only IE supports client side VBScript.

So you need to do it with JavaScript as you pointed out.

This is what I would do (I have done it in normal ASP as I do not have ASP.NET handy here, if your problem is specifically with ASP.NET (and you can do it in ASP) then ignore my whole post)

<%@ Language=VBScript %>
<HTML>
<HEAD>
	<SCRIPT language="JavaScript">
		<%If Request.QueryString("chkOpt1") <> "" Then%>alert("Option 1 selected");<%End If%>
		<%If Request.QueryString("chkOpt2") <> "" Then%>alert("Option 2 selected");<%End If%>
		<%If Request.QueryString("chkOpt3") <> "" Then%>alert("Option 3 selected");<%End If%>
		<%If Request.QueryString("chkOpt4") <> "" Then%>alert("Option 4 selected");<%End If%>			
	</SCRIPT>
</HEAD>
<BODY>

<P>
	<FORM id="frmMain" name="frmMain" action="example.asp" method="get">
		<INPUT type="checkbox" name="chkOpt1"> Option 1<BR>
		<INPUT type="checkbox" name="chkOpt2"> Option 2<BR>
		<INPUT type="checkbox" name="chkOpt3"> Option 3<BR>
		<INPUT type="checkbox" name="chkOpt4"> Option 4<BR>
		<INPUT type="submit" name="cmdSubmit" value="Submit">
	</FORM>
</P>

</BODY>
</HTML>


It is not very elegant (you could use a Select Case instead of the Ifs and combine the alert into one) but it works.

Shout if you need the ASP.NET version, though this will work under ASP.NET.

regards,
Paul Watson
Bluegrass
Cape Town, South Africa

"The greatest thing you will ever learn is to love, and be loved in return" - Moulin Rouge

Martin Marvinski wrote:
Unfortunatly Deep Throat isn't my cup of tea

Do you Sonork? I do! 100.9903 Stormfront
GeneralRe: Message Boxes Pin
Paul Watson31-Jan-02 4:29
sitebuilderPaul Watson31-Jan-02 4:29 
GeneralLogin against a database Pin
28-Jan-02 15:48
suss28-Jan-02 15:48 
GeneralHIGH PROBLEM WITH WINDOW IN JS Pin
28-Jan-02 5:21
suss28-Jan-02 5:21 
GeneralRe: HIGH PROBLEM WITH WINDOW IN JS Pin
Philip Patrick28-Jan-02 11:09
professionalPhilip Patrick28-Jan-02 11:09 
GeneralRe: HIGH PROBLEM WITH WINDOW IN JS Pin
roni schuetz29-Jan-02 18:49
roni schuetz29-Jan-02 18:49 
GeneralRe: HIGH PROBLEM WITH WINDOW IN JS Pin
Philip Patrick29-Jan-02 23:08
professionalPhilip Patrick29-Jan-02 23:08 
Generalwriting files to different machine Pin
omkamal25-Jan-02 7:50
omkamal25-Jan-02 7:50 
GeneralRe: writing files to different machine Pin
Konstantin Vasserman25-Jan-02 16:20
Konstantin Vasserman25-Jan-02 16:20 
GeneralJust another shameless plug Pin
frog_jumps24-Jan-02 8:27
frog_jumps24-Jan-02 8:27 
QuestionHow to test if an object property exists in JS Pin
Wolfram Steinke23-Jan-02 11:43
Wolfram Steinke23-Jan-02 11:43 
AnswerRe: How to test if an object property exists in JS Pin
Konstantin Vasserman23-Jan-02 15:44
Konstantin Vasserman23-Jan-02 15:44 
AnswerRe: How to test if an object property exists in JS Pin
Torsten Mauz11-Mar-02 5:19
Torsten Mauz11-Mar-02 5:19 
GeneralVisual Inheritance in ASP.NET Pin
22-Jan-02 13:44
suss22-Jan-02 13:44 
GeneralRe: Visual Inheritance in ASP.NET Pin
Konstantin Vasserman23-Jan-02 15:31
Konstantin Vasserman23-Jan-02 15:31 
GeneralRe: Visual Inheritance in ASP.NET Pin
24-Jan-02 5:22
suss24-Jan-02 5:22 
GeneralRe: Visual Inheritance in ASP.NET Pin
Konstantin Vasserman24-Jan-02 5:49
Konstantin Vasserman24-Jan-02 5:49 
GeneralDynamic control creation and event handling Pin
omkamal22-Jan-02 11:41
omkamal22-Jan-02 11:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.