Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

ASP.NET - Button not firing up code when pressed

Posted on 2011-10-01
2
Medium Priority
?
221 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 2000 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

Independent Software Vendors: 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.…
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…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
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 anti-spam), the admin…
Suggested Courses

972 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