?
Solved

Calling an ASP.Net sub from an HTML Link

Posted on 2004-10-08
3
Medium Priority
?
202 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 450 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
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 informatio…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Screencast - Getting to Know the Pipeline

807 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