Solved

Confirm Popup after click on a Repeater Button

Posted on 2008-06-12
5
348 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

739 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