By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,652 Members | 1,487 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,652 IT Pros & Developers. It's quick & easy.

ASP:Button OnClientClick and Server Side Not working together

P: n/a
Opa
Hi,

I have a asp:button which allows a user to delete a record, and I wish to
prompt them with a client side confirmation. The javascript confirm
messagebox does show and the cancel button is fine, however when I click OK,
I expect the Server Side Postback OnClick event to fire, but it does not.
Any Ideas?

Here is the code:

<asp:Button ID="BDelete" runat="server" CssClass="buttonRed" Text="Delete"
Width="80px" OnClick="BDelete_Click" UseSubmitBehavior="False"
Visible="False" OnClientClick="return confirm('Delete Work Order?');" />
Aug 31 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
you turned off bowser submit (UseSubmitBehavior="False" ), then have the
client onclick do a return, so the asp.net client code to postback is not
called. either enable bowser submit or

OnClientClick="if (!confirm('Delete Work Order?')) return;"

-- bruce (sqlwork.com)

"Opa" <Op*@discussions.microsoft.comwrote in message
news:16**********************************@microsof t.com...
Hi,

I have a asp:button which allows a user to delete a record, and I wish to
prompt them with a client side confirmation. The javascript confirm
messagebox does show and the cancel button is fine, however when I click
OK,
I expect the Server Side Postback OnClick event to fire, but it does not.
Any Ideas?

Here is the code:

<asp:Button ID="BDelete" runat="server" CssClass="buttonRed" Text="Delete"
Width="80px" OnClick="BDelete_Click" UseSubmitBehavior="False"
Visible="False" OnClientClick="return confirm('Delete Work Order?');" />


Aug 31 '06 #2

P: n/a
Opa
Thanks Bruce. I'll go ahead and try this.

"bruce barker (sqlwork.com)" wrote:
you turned off bowser submit (UseSubmitBehavior="False" ), then have the
client onclick do a return, so the asp.net client code to postback is not
called. either enable bowser submit or

OnClientClick="if (!confirm('Delete Work Order?')) return;"

-- bruce (sqlwork.com)

"Opa" <Op*@discussions.microsoft.comwrote in message
news:16**********************************@microsof t.com...
Hi,

I have a asp:button which allows a user to delete a record, and I wish to
prompt them with a client side confirmation. The javascript confirm
messagebox does show and the cancel button is fine, however when I click
OK,
I expect the Server Side Postback OnClick event to fire, but it does not.
Any Ideas?

Here is the code:

<asp:Button ID="BDelete" runat="server" CssClass="buttonRed" Text="Delete"
Width="80px" OnClick="BDelete_Click" UseSubmitBehavior="False"
Visible="False" OnClientClick="return confirm('Delete Work Order?');" />


Aug 31 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.