Solved

ASP.NET - Button not firing up code when pressed

Posted on 2011-10-01
2
211 Views
Last Modified: 2012-05-12
Hi All,

I have something really weird going on here.

on a .aspx page I have the following code as a first line:

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="cpanel3_cancel.aspx.vb" Inherits="cpanel3_cancel" %>

Then on that page, I have a button, as follows:

<asp:Button ID="Button2" runat="server" Text="Cancel Account" />

and on the file cpanel3_cancel.aspx.vb I have the following code:

    Protected Sub Button2_Click(sender As Object, e As System.EventArgs) Handles Button2.Click
            .....
            .....
    End Sub

But when I click on Button2, nothing happens!

Please help!
0
Comment
Question by:pvg1975
2 Comments
 
LVL 4

Accepted Solution

by:
jacekmalinowski earned 500 total points
ID: 36897045
Hi,

You have to add OnClick to Button:
OnClick= "Button2_Click"
<asp:Button ID="Button2" runat="server" Text="Cancel Account" OnClick= "Button2_Click" />

Open in new window

0
 

Author Comment

by:pvg1975
ID: 36897069
I actually fixed it by setting the runat="server" in the header... so you lead me the right way. Thanks!
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
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…
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…

762 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

23 Experts available now in Live!

Get 1:1 Help Now