Solved

Calling an ASP.Net sub from an HTML Link

Posted on 2004-10-08
3
185 Views
Last Modified: 2012-06-21
Hi,

I'm pretty sure that because what I'm doing is client side as opposed to server side, its not actually possible. However, I thought I'd ask anyway! I'm trying to call an ASP.Net sub from an HTML link using the onClick method. When I do this, I get the undefined error (In my case "Submit" is undefined). What I'm trying to do is this: I have two buttons below a form which submit a username and password to be checked. The problem is that I did not want to use the regular styling of asp buttons, and so tried to use an <img> imbedded in a link to submit the form instead. Is this possible any other way? Thanks for your advice.
0
Comment
Question by:Screwi
  • 2
3 Comments
 
LVL 15

Accepted Solution

by:
Thogek earned 150 total points
ID: 12264370
Try replacing your <img> tag with:

    <input type="image" src="yourImage.gif" />

More info at http://msdn.microsoft.com/workshop/author/dhtml/reference/objects/input_image.asp
0
 

Author Comment

by:Screwi
ID: 12265657
Thanks, Thogek. I didn't exactly use your suggetion, instead I used the control <asp:imagebutton> but I only realised that was available when you mentioned the image input type. Anyway, thanks!
0
 
LVL 15

Expert Comment

by:Thogek
ID: 12269163
<asp:imagebutton> will result in a <input type="image"> tag being sent to the browser, so the two are roughly equivalent.

Just make sure that you have an actual need to reference the ImageButton on the server (such as in using its Click event) -- if so, then that's your tool; but if not, then you're using server resources (to instantiate the ImageButton object) that you don't need, and you'd be better off using a straight <input type="image"> tag.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

743 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

12 Experts available now in Live!

Get 1:1 Help Now