Is it possible to have a server-side click handler for a hyperlink?
A:
It sounds like you're after ASP.net Web Methods, there's an example here.
Basically, you decorate a method in your code-behind with the System.Web.Script.Services.ScriptMethod and System.Web.Script.Services.WebMethod attributes, which means that you can then call the method from javascript.
Rob
2010-07-29 17:12:23
Now you've edited your question to clarify that you want a handler for a hyperlink, p.campbell's answer is more what you need =)
Rob
2010-07-29 17:16:19
A:
Consider converting your hyperlink, perhaps it's an <a> tag, to a ASP.NET server side control: LinkButton.
<asp:LinkButton runat="server" id="foo" OnClick="LinkButton_Click"
Text="Do Some Stuff Server Side, and Expect a Redirect Somewhere" />
It's not clear from the question what you'd like to do server side. From here, you can call custom code and basically do anything once it's posted back.
p.campbell
2010-07-29 17:12:30