Solved

ASP.NET - Button not firing up code when pressed

Posted on 2011-10-01
2
213 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

808 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