Thanks for Teemu's good suggestion.
Hi Alex,
The "OnClientClick" is a new property added in the .net framework 2.0. And
in 1.x, we may need to use codebehind code to programmatically register
such script. e.g:
Button1.Attributes["onclick"] = "if(!confirm('Are you sure?')){return
false};";
And as for the following script:
if(!confirm('Are you sure?'))return false;
you can just expand it to make it looks clearer:
if(!confirm('Are you sure?'))
{
return false;
}
that means if the user click "No" for the confirm javascript dialog, the
code block return false. And return false in client-script event handler
means cancel the current event processing, and for your submit button, it
means stop the postback to server.
Here are some additional web artcles on client script event handling:
#Confirm Delete - Javascript
http://davidhayden.com/blog/dave/arc...03/16/178.aspx
#Advanced JavaScript Event Handling
http://www.webdevelopersjournal.com/...jsevents2.html
Hope this also helps.
Regards,
Steven Cheng
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Get Secure!
www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)