What are you attaching this to? A submit button? If you don't want the form to submit use a plain button not a submit button (ie. define it in client code).
Set UseSubmitButtonBehavior="false" to force a plain button to be created rather than a submit button.
<ww:wwWebButtonrunat="server"id="btnClient" UseSubmitBehavior="false" OnClientClick="doSomething()"Text="Client" />
If you need to shortcut submission of the form then you need:
OnClientClick="return doSomething()"
and return false from the OnClientClick().
In general it's better to not use these JavaScript event handlers on the control, but rather use JavaScript and jQuery to control this:
<script>
$(document).ready( function() {
$("#btnClient").click( function() {
alert("DO Something!");returnfalse;
});
});</script>
This will prevent the submit from submitting and you can skip the OnClientClick() logic altogether. Just make sure to add jQuery to the page.
+++ Rick ---
I have a java script that prompts for confirmation before a delete but the webbutton always does the click event. The doc's say returning a false from the script will prevent the click event but it always fires for me. The script pops up and returns either true or false.
From the doc's:
"If you use OnClientClick() on a submit button the button will still submit the form unless you return false from your JavaScript handler. "
Is there another way to make this work?
Thanks
Ray