Solved

Asp.net image button does not fire on fire on the first click

Posted on 2008-06-12
5
772 Views
Last Modified: 2013-11-26
Experts I am using asp.net 1.1. I added a imagebutton control to my page, for some reason when I click the button the code does not fire, I have to click it a second time to execute the code within the image buttons click event.  The first click just reloads the page so what is going on?
0
Comment
Question by:tentavarious
  • 2
  • 2
5 Comments
 
LVL 22

Expert Comment

by:prairiedog
ID: 21772846
Can I take a look at your Page_Load event handler? Also your Button's Click event handler.
0
 

Author Comment

by:tentavarious
ID: 21778064
Here is the button event
 Private Sub ImageButton1_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton1.Click
   'Code here
 End Sub

Here is page load
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  if not page.ispostback
   'some code here
 end if
 End Sub
0
 
LVL 2

Expert Comment

by:vjc2003
ID: 21819962
Is ImageButton1 indeed the name of your image button? On debugging, is the page is posting back on first click on not entering the button click event handler?
0
 
LVL 22

Accepted Solution

by:
prairiedog earned 125 total points
ID: 21822236
1. Do you have an "onclick" event added to the ImageButton dynamically?
2. What do you do in the Page_Load event handler?
0
 

Author Comment

by:tentavarious
ID: 21824713
I did find the solution, but I am not sure why it worked.  There was a text changed event bound to one of my textfields, after I removed the event, my image button click event worked fine.  Any ideas why?
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

707 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

13 Experts available now in Live!

Get 1:1 Help Now