Solved

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

Posted on 2008-06-12
5
776 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Call Controller Action Method from ASPX 2 22
Sending an input value from a view to a controller in MVC 3 22
Add or delete table rows 10 53
JSON Deserialize issue 6 26
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

792 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