473,464 Members | 1,476 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Strange doubt javascript:confirm

Hi, I have a C# ASP.net 2.0 built on VS 2005, and the piece of code:
javascript:confirm('are you sure delete record?') on gridview at
rowDataBound - OnClientClick, works fine, it asks the user and if cancels,
does nothing... but on my machine at HOME, even when I click cancel it
deletes the records... It´s a very strange problem because to my knowledge
it´s a client feature... What can be the problem ? IE versions ?

Thanks!
Aug 1 '07 #1
5 1211
on my work machine works well, but on my home machine doesnt... both are XP
PRO SP 2

"Paulo Roberto" <pa***********@edt.com.brescreveu na mensagem
news:%2******************@TK2MSFTNGP04.phx.gbl...
Hi, I have a C# ASP.net 2.0 built on VS 2005, and the piece of code:
javascript:confirm('are you sure delete record?') on gridview at
rowDataBound - OnClientClick, works fine, it asks the user and if cancels,
does nothing... but on my machine at HOME, even when I click cancel it
deletes the records... It´s a very strange problem because to my knowledge
it´s a client feature... What can be the problem ? IE versions ?

Thanks!

Aug 1 '07 #2
Paulo Roberto wrote:
Hi, I have a C# ASP.net 2.0 built on VS 2005, and the piece of code:
javascript:confirm('are you sure delete record?') on gridview at
rowDataBound - OnClientClick, works fine, it asks the user and if cancels,
does nothing... but on my machine at HOME, even when I click cancel it
deletes the records... It´s a very strange problem because to my knowledge
it´s a client feature... What can be the problem ? IE versions ?

Thanks!
Don't use the javascript: protocol when you aren't putting the
Javascript in an URL.

The event expects a return value from the code, which is used to
determine if the action should be canceled or not.

So, the correct code is:

OnClientClick="return confirm('are you sure delete record?');"

--
Göran Andersson
_____
http://www.guffa.com
Aug 1 '07 #3
So, the correct code is:
>
OnClientClick="return confirm('are you sure delete record?');"

Göran, my code is the same as yours and works only on my machine at work...
Any suggestion?
Aug 1 '07 #4
"Paulo Roberto" <pa***********@edt.com.brwrote in message
news:%2******************@TK2MSFTNGP04.phx.gbl...
What can be the problem ? IE versions ?
Incorrect syntax is your problem...

OnClientClick="return confirm('Are you sure you want to delete this
record?');"
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Aug 2 '07 #5
Paulo Roberto wrote:
>So, the correct code is:

OnClientClick="return confirm('are you sure delete record?');"


Göran, my code is the same as yours and works only on my machine at work...
Any suggestion?
Have you examined the generated code to see if there are any differences?

--
Göran Andersson
_____
http://www.guffa.com
Aug 2 '07 #6

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

Similar topics

2
by: Jeremy | last post by:
I have a datagrid that users interact with to add/edit/delete, but before the .aspx submits for the delete action I want to pop up a JavaScript confirm box. If the user clicks OK on that box I...
1
by: Muhammad Abdullah | last post by:
Hi am having some problems with the javascript confirm. i have it working fine on one page and it doesnt even pop up at the other. The code on the working page is, private void...
2
by: mark | last post by:
im having issues in creating a javascript confirm option on pressing a delete button in a datagrid - ive tried a few things but nothing seems to work (either crashes or does nothing) my codebehind...
0
by: Chris Fink | last post by:
My goal is to have an ASP.NET checkbox server tag with it's autopostback set to true, that when clicked will run the checkbox's CheckedChanged event. However, I would like to try to add a...
7
by: TJS | last post by:
javascript "confirm" fires after deletion instead of before deletion. how do I get this to stop the processing ? code ================== Sub ShowAlert(ByVal s As string)...
8
by: Dave | last post by:
Hello all, I have been able to use a Javascript alert box in my vb.net web application, for example: Dim msg As String = "Hello, world." Dim alertScript As String = "<script...
5
by: Dave | last post by:
I'm tearing my hair out over this one. Using VS 2003, inline (not code-behind), vb.net. I have a button (btnClear) that calls a vb routine that goes into sql server and truncates a table. ...
8
by: rn5a | last post by:
I have gone through a no. of posts in this NewsGroup regarding my problem but alas, couldn't come across one which would have helped me in resolving the issue. My problem is this: An ASPX Form...
7
by: shil | last post by:
Hi all, Can any one direct me in how to use javascript confirm() function when a condition is met from codebehind. I don't want to attach this to a button. When I submit the page, I want to...
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
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,...
0
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
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...
0
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
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
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...

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.