473,698 Members | 2,588 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

JScript - handling OK/Cancel in confirmation box

hi,

im only learning javascript, i have this little code snippet that i wish to
use. basically the code-behind page will display a little jscript confirm
message box

Public Sub ASPNET_MsgBox(B yVal Message As String)

System.Web.Http Context.Current .Response.Write ("<SCRIPT
LANGUAGE=""Java Script"">" & vbCrLf)

System.Web.Http Context.Current .Response.Write ("confirm("" " & Message & """)"
& vbCrLf)

System.Web.Http Context.Current .Response.Write ("</SCRIPT>")

End Sub
what i was wanting to know. is what do i have to do in the HTML in order to
tell which button they click (OK/Cancel) on the confirm message box, so that
i can then call the correct function in my codebehind page.

Cheers,
Craig
Nov 19 '05 #1
3 8949
I don't know why you are writing this function on server side. This could
have been a Javascript function within the page. In that case, it probably
would have made things easier for you. All you would have to do is add an
attribute to your aspnet button in code to call the Javascript Function

This article explains it better than me:

http://aspnet.4guysfromrolla.com/articles/021104-1.aspx

"Craig G" wrote:
hi,

im only learning javascript, i have this little code snippet that i wish to
use. basically the code-behind page will display a little jscript confirm
message box

Public Sub ASPNET_MsgBox(B yVal Message As String)

System.Web.Http Context.Current .Response.Write ("<SCRIPT
LANGUAGE=""Java Script"">" & vbCrLf)

System.Web.Http Context.Current .Response.Write ("confirm("" " & Message & """)"
& vbCrLf)

System.Web.Http Context.Current .Response.Write ("</SCRIPT>")

End Sub
what i was wanting to know. is what do i have to do in the HTML in order to
tell which button they click (OK/Cancel) on the confirm message box, so that
i can then call the correct function in my codebehind page.

Cheers,
Craig

Nov 19 '05 #2
Craig,

Usually you don't need to make a roundtrip to server just to make a
confirmation box. You should call confirm on client side in a client event
handler. There are several ways of passing information from client to
server. Most common one is using hidden input fields.

<input id="inhConfirm " type=hidden runat="server">
....
inhConfirm.valu e=confirm('mess age');

Eliyahu

"Craig G" <cr**********@y arrasoftware.co m> wrote in message
news:ej******** ******@TK2MSFTN GP12.phx.gbl...
hi,

im only learning javascript, i have this little code snippet that i wish to use. basically the code-behind page will display a little jscript confirm
message box

Public Sub ASPNET_MsgBox(B yVal Message As String)

System.Web.Http Context.Current .Response.Write ("<SCRIPT
LANGUAGE=""Java Script"">" & vbCrLf)

System.Web.Http Context.Current .Response.Write ("confirm("" " & Message & """)" & vbCrLf)

System.Web.Http Context.Current .Response.Write ("</SCRIPT>")

End Sub
what i was wanting to know. is what do i have to do in the HTML in order to tell which button they click (OK/Cancel) on the confirm message box, so that i can then call the correct function in my codebehind page.

Cheers,
Craig

Nov 19 '05 #3
Cheers. that link was basically what i was looking for

Cheers,
Craug

"Tampa .NET Koder" <Ta***********@ discussions.mic rosoft.com> wrote in
message news:29******** *************** ***********@mic rosoft.com...
I don't know why you are writing this function on server side. This could
have been a Javascript function within the page. In that case, it probably
would have made things easier for you. All you would have to do is add an
attribute to your aspnet button in code to call the Javascript Function

This article explains it better than me:

http://aspnet.4guysfromrolla.com/articles/021104-1.aspx

"Craig G" wrote:
hi,

im only learning javascript, i have this little code snippet that i wish to use. basically the code-behind page will display a little jscript confirm message box

Public Sub ASPNET_MsgBox(B yVal Message As String)

System.Web.Http Context.Current .Response.Write ("<SCRIPT
LANGUAGE=""Java Script"">" & vbCrLf)

System.Web.Http Context.Current .Response.Write ("confirm("" " & Message & """)" & vbCrLf)

System.Web.Http Context.Current .Response.Write ("</SCRIPT>")

End Sub
what i was wanting to know. is what do i have to do in the HTML in order to tell which button they click (OK/Cancel) on the confirm message box, so that i can then call the correct function in my codebehind page.

Cheers,
Craig

Nov 19 '05 #4

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

Similar topics

4
5553
by: Mark D. Anderson | last post by:
About a month ago Richard Cornford did an interesting analysis of a memory leak in jscript (internet explorer) when there are "circular" references between DOM objects and (real) jscript objects: http://groups.google.com/groups?selm=bcq6fn%24g53%241%248300dec7%40news.demon.co.uk This message summarizes some testing I've done and their results. These results somewhat contradict Cornford's conclusions; I haven't
6
1398
by: Berislav Lopac | last post by:
One of the banes of contemporary JavaScript programming for the Web is the differences between JScript and JavaScript -- specifically, a number of non-standard, but useful objects and/or methods (especially DHTML-related) which are available in the former, but not the latter. Since JavaScript engine in Gekko is very strong, I came to realize that the easiest way to achieve platform independence would be to write specifically for JScript,...
14
2816
by: John Bentley | last post by:
Note this is crossposted to comp.lang.javacript and microsoft.public.dotnet.scripting. After some Googling and FAQing my understanding of these terms is, crudely: Javascript (3 different definitions): 1. The scripting language originally developed by Netscape. (I offer a Brief handle: "Original Netscape Script") 2. The current implementation of the ECMAscript 262 (3rd ed.) standard by Netscape. (I offer a brief handle: "Current...
5
5244
by: benc | last post by:
Hi Can some good soul help on this. I need to call jscript functions from C#. I have hosted a web control and displayed an html page successfully, but just can't find a way to call jscript functions or set some var in the html. There are some sample code in C++ using IDispatch but these are beyond me. Looked at Tim Anderson's work on HTMLEditor but couldn't find any example on calling jscript function. Read somewhere that the browser...
4
2114
by: Tad Marshall | last post by:
Hi, I'm having limited luck getting an ApplicationException to work right in my code. This is VB.NET, VS 2003, Windows XP SP2, .NET Framework 1.1. I thought it would be convenient to take advantage of exception handling to deal with the case of the user clicking the Cancel button while a long operation was running. So, I declared a class inherited from ApplicationException and I Throw one of these with the text "User pressed Cancel"...
2
9334
by: sowmyap | last post by:
Hi, My requirement is I have an asp page in which there is a textbox. If the user clicks on close(X) button in IE without entering a value in the textbox I want a pop up to appear like "Please enter the value" and the window should not close. Kindly advoice. I don't want the browser confirmation with Ok and cancel. B'coz if the user clicks on OK the window will close. regards, Sowmya
0
998
by: Simon Rigby | last post by:
Hi all, I was of the impression that setting the DefaultMode property of a FormView would force the EditMode back to the defaut mode after clicking update or cancel. However, the FormView stays in the current mode (Edit in my example) when I clcik update or cancel. The update does occur on clicking the update and cancel undoes the changes in the form but the mode doesnt switch. I've been reading a couple of posts that "suggest" this...
0
2810
by: Eraser | last post by:
Hi to all .NET guru guys... I have a problem in my delete button inside gridview. How to avoid postback on when i select cancel on confirmation message? But postback is okay on Ok confirmation. What happened is if I select cancel on my confirmation button, it executes the griedview postback which i assigned in my code behind. Please see my codes below... Code beind: protected void gvDefectCatalog_RowDataBound(object sender,...
1
8100
by: jobs | last post by:
re: Attributes.Add Onclick (javascript) trapping CANCEL Hello. The following asp.net/vb.net code produces a confirmation Submitbutton.Attributes.Add("onClick", "return confirm('Is this okay?')") My question is, when the confirmation comes up, I want cancel to do a back. Currently it just stops the form from posting.
0
8680
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8609
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9169
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9030
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7738
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6528
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5861
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4371
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2335
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.