473,385 Members | 1,375 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

"i want used confirm in javascript in code behind"

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='javascript'>var agree= confirm('Are you sure to cancel the ticket?');if(agree){ return true};else {return false;}</script>"
'Page.RegisterStartupScript("PopupScript6", 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("<script language='javascript'>")

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

str.Append("return true;}")
str.Append("else {")

str.Append("return false;}")
str.Append("</script>")
RegisterStartupScript("TicketNumber", str.ToString)

so please help me...
Jun 13 '07 #1
2 4813
kenobewan
4,871 Expert 4TB
Try using attributes.add(). HTH.
Jun 13 '07 #2
Frinavale
9,735 Expert Mod 8TB
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
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...
1
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...
4
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
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...
7
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...
0
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...
2
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
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
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.