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.

114 questions
83
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
  • 40,013
  • 6
  • 62
  • 64
55
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,469
  • 3
  • 22
  • 36
27
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
  • 704
  • 4
  • 13
  • 37
26
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,331
  • 77
  • 181
  • 330
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,483
  • 5
  • 19
  • 27
12
votes
7 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,373
  • 9
  • 40
  • 72
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
  • 90,223
  • 44
  • 210
  • 255
8
votes
5 answers

how to bind javascript function with OnClientClick event with Eval?

my link button - and the javascript msgDisp is-