Questions tagged [onclientclick]

The OnClientClick property is used to sets a client side script to be run when the Button control is clicked.

The OnClientClick property is used to sets a client side script to be run when the Button control is clicked.

This event triggers whenever the user clicks his mouse.

118 questions
84
votes
9 answers

OnClick vs OnClientClick for an asp:CheckBox?

Does anyone know why a client-side javascript handler for asp:CheckBox needs to be an OnClick="" attribute rather than an OnClientClick="" attribute, as for asp:Button? For example, this works:
Stobor
  • 44,246
  • 6
  • 66
  • 69
56
votes
7 answers

OnclientClick and OnClick is not working at the same time?

I have a button like the following, When I use my button like that, onclick is not firing. When I remove OnClientClick, then…
stckvrflw
  • 1,489
  • 3
  • 22
  • 37
30
votes
5 answers

Stopping onclick from firing when onclientclick is false?

Is it possible to use the onclientclick property of a button to do a clientside check. If the check returns true, then fire the onclick event. If the clientside check returns false, don't fire the onclick event. Is that possible? UPDATE: These 2…
oshirowanen
  • 15,297
  • 82
  • 198
  • 350
29
votes
8 answers

Get text of label with jquery

I want to do very simple thing, but I'm not success. I have button and label on my asp.net page and I want to get text of label after clicking on button. Here is my code: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs"…
Rougher
  • 834
  • 5
  • 19
  • 46
15
votes
8 answers

ASP.NET OnClientClick="return false;" doesn't work

I just want to add some client side (JQuery Javascript) validation in a web user control. I put an OnClientClick handler and the function gets called. BUT, even if I return "false", the OnClick method always get fired. What am I doing wrong ? I'm…
Patrice Cote
  • 3,572
  • 12
  • 43
  • 72
14
votes
12 answers

ASP.NET confirm before executing codebehind

I have a form where a user can delete a record, and I want a pop-up message where the user has to click okay to confirm the delete. Delete button:
Sara
  • 1,573
  • 5
  • 19
  • 27
9
votes
2 answers

Why doesn't returning false from OnClientClick cancel the postback

I have a LinkButton where I use the OnClientClick property to ask the user whether he really wants to perform an action, e.g:
M4N
  • 94,805
  • 45
  • 217
  • 260
8
votes
5 answers

how to bind javascript function with OnClientClick event with Eval?

my link button - and the javascript msgDisp is-