473,597 Members | 2,174 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

"i want used confirm in javascript in code behind"

21 New Member
Hai....

"i want used confirm in javascript in code behind"

i am used confirm button ,,,in code behind.

if the confirm button worked

the function is return the true...

else

the function return the false..

i want to get true and false value for my further proces..

this my code..

Dim popupScript6 As String = "<script language='javas cript'>var agree= confirm('Are you sure to cancel the ticket?');if(ag ree){ return true};else {return false;}</script>"
'Page.RegisterS tartupScript("P opupScript6", popupScript6)

in my codebehind window i want to get "agree" value....

in this popupScript6 used confirm coding is worked...but i wrote return word..this is nothing done..

i ma used return word is not worked..

please how can use this statement..

how can i get return value..

because i got the return value..

then my next code if(true) the redirect to another page...

so please hrlp me...

i am used this code also code..

but the same process done this also return word is used in not working..

this code..

Dim str As StringBuilder = New StringBuilder
str.Append("<sc ript language='javas cript'>")

str.Append("var agree= confirm('Are you sure to cancel the ticket?');")
str.Append("if( agree){")

str.Append("ret urn true;}")
str.Append("els e {")

str.Append("ret urn false;}")
str.Append("</script>")
RegisterStartup Script("TicketN umber", str.ToString)

so please help me...
Jun 13 '07 #1
2 4831
kenobewan
4,871 Recognized Expert Specialist
Try using attributes.add( ). HTH.
Jun 13 '07 #2
Frinavale
9,735 Recognized Expert Moderator Expert
You're on the right track.
As Kenobewan said you'll need to uset the btn.Attributes. Add() function to add the onclick JavaScript to your button:

Expand|Select|Wrap|Line Numbers
  1. BTN_Restart.Attributes.Add("onclick", "javascript: if(confirm('Are you sure you want to restart the process?')==true) {document.getElementById('__Restart').value=true;}")
  2.  
In this code a hidden field with the id="__Restart" is to true because the button will still submit the form to the server. When the Restart Button click event occurs check to see if this value is true or not and execute the appropriate code.

Hope this helps!

-Frinny
Jun 13 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

25
3723
by: delerious | last post by:
I see some code examples like this: <DIV onmouseover="this.style.background='blue'"> and other code examples like this: <DIV onmouseover="javascript:this.style.background='blue'"> Which way is more proper? Or are both ways perfectly fine? Are there any specifications that discuss when "javascript:" should be put in front of code?
1
6169
by: Alan | last post by:
I post this message here because I have post in js.group before, but onone answer, thus i guess this is ASP issue. <A HREF="http://SomeWebSite" OnClick="return confirm('Are you sure?')">Click me</A> or <A HREF="http://SomeWebSite" OnClick="return confirm('Are you
4
3109
by: Rui Santos | last post by:
Folks, How can change the text labels in the "confirm" buttons? Instead OK and Cancel, i want "Yes" and "No". Regards, Rui
7
2021
by: calan | last post by:
I need a dialog box with Yes, No, and Cancel buttons that pops up when a link is clicked. I'm using asp on the server side, and basically, if the user clicks yes, I want to go to a certain page and pass a certain variable value. For example: href="my_page.asp?answer=yes" If they click no, I would call :
7
3283
by: RFS666 | last post by:
Hello, I would like to use variables with a type in jscript.NET. I declare them as follows: var x : double = 5.03; This doesn't work in my script, that I write to the page in codebehind with "registerClientScriptBlock" as follows: string script = "<script language=jscript>"; script += "function test()";
0
1670
by: JT | last post by:
In looking around on the internet to find out how to use a "messagebox"-like window on a webform, I have come across a few examples of how to do so from the "onclick" event of a button. In my situation I am using a third party treeview control that has a context menu on each node. If a user clicks on one of the context menu options, I would like for a "confirm" box to pop up and make sure that's what they wanted to do. I would be very...
2
3576
by: Navodit | last post by:
Hi I am new to Javascript and am not sure what is the difference between the following two statements: <script type="text/javascript"> ..... </script>
1
1978
by: thirunavukarasukm | last post by:
Hai.... "i want used confirm in javascript in code behind" i am used confirm button ,,,in code behind. if the confirm button worked the function is return the true...
8
5056
by: howa | last post by:
Just found a funny things.. in HTML4's dtd, http://www.w3.org/TR/html4/strict.dtd language is not valid, i.e. <!ELEMENT SCRIPT - - %Script; -- script statements --> <!ATTLIST SCRIPT charset %Charset; #IMPLIED -- char encoding of linked resource --
0
7884
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
8267
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
8380
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...
1
8024
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6681
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
5844
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
5423
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
3880
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...
1
1493
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.