ASP.net 2.0 OnClientClick imageButton problem.

Here's the sample url:
http://webspider.com/Default.aspx?search=sample
I'm having a problem with getting the onClientClick to work. As you can see on the page, there is images and I have set all their URL's dynamically so that they link to the product descriptions. However, it doesn't seem to be working as you can see in the url. It just posts back to the same page. The page pops up with a script error at the exact location of the imageButton. Any ideas as to what's causing my problem?
jumpstart0321Asked:
Who is Participating?
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.

amanolaCommented:
Does your OnClientClick reference a JavaScript? OnClientClick is used for client side scripting OnClick is used for server side scripting. What is your script handled OnClientClick?
0
amxCommented:
The javascript in the onClientClick is incorrect

it should be like this:
onclick="document.location.href = 'http://www.webspider.com/69218 Sample by Meyda Tiffany_13494513.html';"
0
amanolaCommented:
My other thought is that if all you want to do is link to another page you can use the PostBackUrl of the ImageButton to just enter a link. This can also be bound to if necessary.
0
prairiedogCommented:
If all you need is to direct user to another page upon click, then use HyperLink instead of ImageButton. Set HyperLink's ImageUrl to the product's picture and set NavigateUrl to the destination url which can be constructed dynamically.
The ImageButton control will cause postbacks, but HyperLink control will not.
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
jumpstart0321Author Commented:
Thanks for all the help guys. I didn't reference anyexternal javascript, however; I believe the control automatically makes its own javascript at runtime. I tried the PostBackURL and got the same result. I took prariedog's suggestion and just used a basic <a href... control. Much easier and I'm sure it will be more SEO compatible. Thanks again guys.
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.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.