Solved

Confirm Popup after click on a Repeater Button

Posted on 2008-06-12
5
343 Views
Last Modified: 2013-12-17
I have a Repeater, it has 4 different commands for each item, I want to throw a popup box asking the user to CONFIRM the action they requested, they can say NO and nothing happends or YES and the event fires. Is there a way to do this? Is there any Confirm Control I can tie to a single button on my Repeater?

Thanks
0
Comment
Question by:victorbello
  • 3
5 Comments
 
LVL 43

Accepted Solution

by:
TimCottee earned 350 total points
ID: 21770337
Hello victorbello,

The answer is yes, in principle you need to add a client-side script to the click event of each button. Now how to do that may vary depending on whether you are running asp.net 1.1 or 2+, I am guessing 2.0 or higher so you will need to add the onclientclick attribute e.g.,

<asp:button id="something" onclientclick="return confirm('Are you sure you want to do this?');" />

Using this it will either postback if you confirm the action or do nothing if you cancel it.

Regards,

TimCottee
0
 
LVL 15

Assisted Solution

by:NazoUK
NazoUK earned 150 total points
ID: 21770350
add this to your buttons:

OnClientClick="return confirm('Are you sure?');"
0
 
LVL 3

Author Comment

by:victorbello
ID: 21770437
Let me give that a try.
0
 
LVL 3

Author Comment

by:victorbello
ID: 21770517
It works, but I have another quick question, how do I get a linebreak on the text? I have a LONG text, i want a line break to show different lines, is it possible? I tried <br /> and Environment.NewLine but nothing, any ideas?
0
 
LVL 3

Author Comment

by:victorbello
ID: 21770712
Got it, i just needed to add the \n\r there.

Thanks for all the help.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now