Solved

Confirm Popup after click on a Repeater Button

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Authentication of Web Services 3 53
Syntax Error 2 47
Why is some text in blue in Visual Studio? 6 24
Receiving a string from a WebService Push 21 37
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 …
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

895 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

15 Experts available now in Live!

Get 1:1 Help Now