views:

13

answers:

2

I have a simple htmlinputbutton of type "submit" in my aspx page.

<input id="Submit1" runat="server" type="submit" value="submit"/>

If I click it I want to handle this as an event on the server. Much like how a normal asp:Button would do.

EDIT: I've tried the onserverclick thingy...it didn't work. Used onserverclick="foo"

In my code behind did something like:

void foo(object s, EventArgs e)
{

}
A: 
<input id="Submit1" runat="server" value="submit" onclick="" type="submit" />

In the onclick parameters you can put a custom event handler in java script.

If you want to use a code behind in the C# file I would recommend doing a post back and passing in the post back event arguments, and then have your page load catch those event arguments. You can get event arguments using:

Request["__EVENTARGUEMNT"];
Jacob Nelson
A: 

HtmlInputButton provides a ServerClick which should do what you're looking for.

R0MANARMY
this seems to work now...1derin y it didn't wrk earlier...
deostroll