ASP.NET 3.5 / AJAX - ImageButton_Click is undefined

Hi,

Having just deployed my first website in ASP.NET with use of the Ajax Library I have recently been informed of an error message in IE 7 where I am using an ASP:ImageButton (it works in Firefox and Chrome).

The error message is 'ImageButton1_Click' is undefined. There are probably about 6 or 7 ImageButtons in the whole project and each time I get the same error message but with a different object name.

Having tried ASP:Buttons and ASP:LinkButtons neither of these work too.

I have researched and googled as much as I possiblity can with no solutions. I hate to admit defeat so please can an expert help?

Many thanks in advance.

PS - The "code behind" the button is  
<form runat="server">
<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/images/design/button_green_confirm.png" OnClientClick="ImageButton1_Click" /></form>


Partial Class index
    Inherits System.Web.UI.Page

    Protected Sub ImageButton1_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton1.Click
        Dim strIsThisDoingMyNut As String
        strIsThisDoingMyNut = "Hell Yes!"
    End Sub
End Class

Open in new window

LVL 5
advfinanceAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

guru_samiCommented:
You have OnClientClick="ImageButton1_Click"
so it is expecting a javascript method on Client side...

If you want to just use serverside method that you have above in your code then remove that part: OnClientClick="ImageButton1_Click" ...as it is not necessary.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
David RobitailleAnalyst ProgrammerCommented:
or use OnClick="ImageButton1_Click" ...
0
advfinanceAuthor Commented:
And that's why they call you a genius!

Thanks buddy - I didn't even consider that ClientClick would mean a client side operation (may come in very handy someday). You learn something new ever day!

Cheers :o)
0
Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

advfinanceAuthor Commented:
Fantastic
0
guru_samiCommented:
--> or use OnClick="ImageButton1_Click" .

No that is not required ....as "Handles ImageButton1.Click" should take care of that ....

Adding that might cause button click to fire twice ....depending on AutoEventWireup property...
0
David RobitailleAnalyst ProgrammerCommented:
guru_sami, you are right. it`s either a handle or a onClick, not both.
 I just wanted to mention that the property to use when you want to set a sub to handle the click event from the aspx code is OnClick, not onClientClick.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.