|
|
|
start date: Wed, 1 Aug 2007 19:37:36 -0300,
posted on: microsoft.public.dotnet.framework.aspnet
back
| Thread Index |
|
1
Paulo Roberto
|
|
2
Paulo Roberto
|
|
3
Göran Andersson
|
|
4
Paulo Roberto
|
|
5
Göran Andersson
|
|
6
Mark Rae [MVP]
|
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... Its a very strange problem because to my knowledge
its a client feature... What can be the problem ? IE versions ?
Thanks!
Date:Wed, 1 Aug 2007 19:37:36 -0300
Author:
|
Re: Strange doubt javascript:confirm
on my work machine works well, but on my home machine doesnt... both are XP
PRO SP 2
"Paulo Roberto" escreveu na mensagem
news:%23Po%23f0I1HHA.1188@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... Its a very strange problem because to my knowledge
> its a client feature... What can be the problem ? IE versions ?
>
> Thanks!
>
Date:Wed, 1 Aug 2007 19:58:56 -0300
Author:
|
Re: Strange doubt javascript:confirm
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... Its a very strange problem because to my knowledge
> its 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?');"
--
Gran Andersson
_____
http://www.guffa.com
Date:Thu, 02 Aug 2007 01:41:07 +0200
Author:
|
Re: Strange doubt javascript:confirm
> So, the correct code is:
>
> OnClientClick="return confirm('are you sure delete record?');"
>
Gran, my code is the same as yours and works only on my machine at work...
Any suggestion?
Date:Wed, 1 Aug 2007 20:44:43 -0300
Author:
|
Re: Strange doubt javascript:confirm
"Paulo Roberto" wrote in message
news:%23Po%23f0I1HHA.1188@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
Date:Thu, 2 Aug 2007 00:52:49 +0100
Author:
|
Re: Strange doubt javascript:confirm
Paulo Roberto wrote:
>> So, the correct code is:
>>
>> OnClientClick="return confirm('are you sure delete record?');"
>>
>
>
> Gran, 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?
--
Gran Andersson
_____
http://www.guffa.com
Date:Thu, 02 Aug 2007 12:47:53 +0200
Author:
|
|
|