Solved

Confirm Popup after click on a Repeater Button

Posted on 2008-06-12
5
349 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

Technology Partners: 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

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

726 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