Here is what I want to do. Use this HTML line and have the ASP .NET server-side deal with the onclick event.
I don’t want to use nor do I want to use an anchor tag which would both allow me to capture the server-side successfully.
I want to use this:
<input type="button" id="submit" name="submit" value="See Your Results" onclick="" />
The onclick attribute for this HTML typically directs the event to a Javascript event handler, which I do not want to use.
This question (http://stackoverflow.com/questions/3445515/input-typebutton-runatserver-wont-work-in-asp-net) details a similar issue, but the end result is to use . I am wondering if it’s possible to handle the input tag without resorting to the tag use.
Thanks!
I believe you need to add
runat="server".Then your
onclickwill call a server-side method.This needs to be in a server form tag (see code below).
Here’s some information about HTML server controls.
And here’s some sample code that you can play with on their webpage:
Declare two
HtmlButtoncontrols in an .aspx file (remember to embed the control inside anHtmlFormcontrol). Next, write an event handler that specifies what to happen when a button is clicked.