Solved

client side button confirm not working

Posted on 2008-06-18
2
270 Views
Last Modified: 2013-12-16
For some reason my client side button confirm is not working.  I'm using IE7, windows vista, and I have duplicated this in both VS 08 and VS 05, and neither work.  When I click the button, the confirm shows up, but when I click cancel, the page still posts back.  What am I missing?!?!?!?!
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Button ID="Button1" runat="server" Text="Button" />
    </div>
    </form>
</body>

public partial class _Default : System.Web.UI.Page {
    protected void Page_Load(object sender, EventArgs e) {
        Button1.Attributes["onclick"] = "javascript:return confirm('dffddads');";
    }
}
0
Comment
Question by:ARACK04
[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
2 Comments
 
LVL 16

Accepted Solution

by:
ororiole earned 500 total points
ID: 21818909
change it to
Button1.Attributes["OnClientClick"] = "javascript:return confirm('dffddads');";

onclick is in the end a server side event so it is going to postback by default. You want this to be a client side event so use OnClientClick.
0
 

Author Comment

by:ARACK04
ID: 21818922
Nope, the answer is here, but thanks.

http://www.developerfusion.co.uk/forums/p/36114/165895/#165895 
0

Featured Post

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

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

Suggested Solutions

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

697 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