Solved

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

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

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

Suggested Solutions

Title # Comments Views Activity
Testing of the web services 1 48
ASP.NET - Why is accordion not working? 3 46
Access is denied error from google drive api v2 in asp.net 1 44
Securing WEBAPI on Azure 2 21
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

763 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