P
phil
Hi,
When the button is clicked, the server event in the code-behind must be
executed if the user clicked on "OK" of the Confirm and not executed if
clicked on "Cancel".
I tried two ways: the first here below NEVER executes the server event and
the second way ALWAYS execute the server event!!
First way (server event never executed)
---------------------------------------
<form id="form1" runat="server">
<input id="Button1" type="button" value="button" runat="server"
onclick="return confirm('are you sure?');" />
</form>
Second way (server event amways executed)
---------------------------------------------
<form id="form1" runat="server">
<input id="Button1" type="button" value="button" runat="server"
onclick="hfd();" />
</form>
<script language="javascript" type="text/javascript">
function hfd()
{return confirm("are you sure?")}
</script>
Code-behind:
-------------
Protected Sub Button1_ServerClick(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.ServerClick
Response.Write("ok from server")
End Sub
What's the reason of this and is there a way to find the average between
never and always (executed when "OK" and not when "Cancel")?
Thanks
Phil
When the button is clicked, the server event in the code-behind must be
executed if the user clicked on "OK" of the Confirm and not executed if
clicked on "Cancel".
I tried two ways: the first here below NEVER executes the server event and
the second way ALWAYS execute the server event!!
First way (server event never executed)
---------------------------------------
<form id="form1" runat="server">
<input id="Button1" type="button" value="button" runat="server"
onclick="return confirm('are you sure?');" />
</form>
Second way (server event amways executed)
---------------------------------------------
<form id="form1" runat="server">
<input id="Button1" type="button" value="button" runat="server"
onclick="hfd();" />
</form>
<script language="javascript" type="text/javascript">
function hfd()
{return confirm("are you sure?")}
</script>
Code-behind:
-------------
Protected Sub Button1_ServerClick(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.ServerClick
Response.Write("ok from server")
End Sub
What's the reason of this and is there a way to find the average between
never and always (executed when "OK" and not when "Cancel")?
Thanks
Phil