473,406 Members | 2,894 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

How to stop an event firing in Client Side Scripting

Hello,

I have a Web Form which has two imagebuttons (Save and Cancel). I´d like to
show the user a confirm dialog whenever he clicks on the Cancel Button and
based on his answer to this confirmation continue with the postback or
cancel the action.

How could I do that?

Whenever the user clicks on the cancel buttton I get the dialog but no
matter what answer the user gives I still get a postback.
btnCancelar.Attributes.Add("onclick","event.cancel Bubble = !confirm('¿Desea
Cancelar la Edición de la Prima?');");

TIA,

Jorge Luzarraga
Nov 18 '05 #1
4 1412
btnCancelar.Attributes.Add("onclick","return !confirm('¿Desea Cancelar la
Edición de la Prima?');");
-- bruce (sqlwork.com)
"Jorge Luzarraga C" <jl********@fidens.cl> wrote in message
news:e7**************@tk2msftngp13.phx.gbl...
Hello,

I have a Web Form which has two imagebuttons (Save and Cancel). I´d like to show the user a confirm dialog whenever he clicks on the Cancel Button and
based on his answer to this confirmation continue with the postback or
cancel the action.

How could I do that?

Whenever the user clicks on the cancel buttton I get the dialog but no
matter what answer the user gives I still get a postback.
btnCancelar.Attributes.Add("onclick","event.cancel Bubble = !confirm('¿Desea Cancelar la Edición de la Prima?');");

TIA,

Jorge Luzarraga

Nov 18 '05 #2
Jorge,

If you don't want a postback, why are you using imagebutton webcontrol? Use
html <img ..> instead.

Eliyahu

"Jorge Luzarraga C" <jl********@fidens.cl> wrote in message
news:e7**************@tk2msftngp13.phx.gbl...
Hello,

I have a Web Form which has two imagebuttons (Save and Cancel). I´d like to show the user a confirm dialog whenever he clicks on the Cancel Button and
based on his answer to this confirmation continue with the postback or
cancel the action.

How could I do that?

Whenever the user clicks on the cancel buttton I get the dialog but no
matter what answer the user gives I still get a postback.
btnCancelar.Attributes.Add("onclick","event.cancel Bubble = !confirm('¿Desea Cancelar la Edición de la Prima?');");

TIA,

Jorge Luzarraga

Nov 18 '05 #3
Thanks for the Help, Bruce.

Actually the solution you proposed was one.

btnCancelar.Attributes.Add("onclick","return confirm('¿Desea Cancelar la
Edición de la Prima?');");

I also learned (after digging a while in the msdn.com website) that I could
inherit the ImageButton to get the behaviour I was looking for so I would
get a ConfirmImageButton.

I´ve attached the link to that article which seems interesting.

http://msdn.microsoft.com/library/de...ientsidesc.asp

"bruce barker" <no***********@safeco.com> escribió en el mensaje
news:Ot**************@TK2MSFTNGP09.phx.gbl...
btnCancelar.Attributes.Add("onclick","return !confirm('¿Desea Cancelar la
Edición de la Prima?');");
-- bruce (sqlwork.com)
"Jorge Luzarraga C" <jl********@fidens.cl> wrote in message
news:e7**************@tk2msftngp13.phx.gbl...
Hello,

I have a Web Form which has two imagebuttons (Save and Cancel). I´d like

to
show the user a confirm dialog whenever he clicks on the Cancel Button and based on his answer to this confirmation continue with the postback or
cancel the action.

How could I do that?

Whenever the user clicks on the cancel buttton I get the dialog but no
matter what answer the user gives I still get a postback.
btnCancelar.Attributes.Add("onclick","event.cancel Bubble =

!confirm('¿Desea
Cancelar la Edición de la Prima?');");

TIA,

Jorge Luzarraga


Nov 18 '05 #4
Because I wanted a deterministic postback depending on the confirm dialog.
Anyway I got the solution. Thanks for your help anyway.
"Eliyahu Goldin" <re*************@monarchmed.com> escribió en el mensaje
news:u3**************@TK2MSFTNGP11.phx.gbl...
Jorge,

If you don't want a postback, why are you using imagebutton webcontrol? Use html <img ..> instead.

Eliyahu

"Jorge Luzarraga C" <jl********@fidens.cl> wrote in message
news:e7**************@tk2msftngp13.phx.gbl...
Hello,

I have a Web Form which has two imagebuttons (Save and Cancel). I´d like

to
show the user a confirm dialog whenever he clicks on the Cancel Button and based on his answer to this confirmation continue with the postback or
cancel the action.

How could I do that?

Whenever the user clicks on the cancel buttton I get the dialog but no
matter what answer the user gives I still get a postback.
btnCancelar.Attributes.Add("onclick","event.cancel Bubble =

!confirm('¿Desea
Cancelar la Edición de la Prima?');");

TIA,

Jorge Luzarraga


Nov 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Murphy | last post by:
As I understand the click event is initiated by JavaScript what happens in the event where a browser has disabled client side scripting or doesn't support it ? If writing a site is it better to...
1
by: Bin Song, MCP | last post by:
Hi all I got a strange problem In my webform, I have a server-side Button "btnDisable" to save some data and enable or disable all other fields in this form based on the data. The logic is: on...
1
by: Ahmet Gunes | last post by:
Hi all, I check whether session is alive in Page_Load. If session is not alive then I want to navigate to another page, most probably the login page. But when a control, a button for...
1
by: jose.mendez22 | last post by:
I have created a label ctl and an OnClick event handler which works correclty. However I would also like to pass the event two parameters so I cand do further logic. Does anyone know the syntax...
0
by: Demetri | last post by:
I have created a web control that can be rendered as either a linkbutton or a button. It is a ConfirmButton control that allows a developer to force a user to confirm if they intended to click it...
4
by: sowencheung | last post by:
Hi, all The scenario is like this: I have a master page, contains two user controls, one is a search control, another is a login control. The server-side <form> is in the master page,...
19
by: Daniela Roman | last post by:
Hello, I try to fire an event under a button click event and maybe anybody can give a clue please. I have let's say a WEB grid with PageIndexChanged event: private void...
2
by: John Kotuby | last post by:
Hi guys, I am converting a rather complicated database driven Web application from classic ASP to ASP.NET 2.0 using VB 2005 as the programming language. The original ASP application works quite...
7
controlbox
by: controlbox | last post by:
I have recently inplemented some drop-down lists (combos) on a page where one is dynamically populated according to the selection of another using the microsoft ajax extensions. I had to set...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.