I have a link that looks like a button from this html
<p class="link-styleContact"><a href="#"><span>Email Contact Form</span></a></p>
can I run a code behind file when this is clicked on by adding the routine name to the href? like below
<p class="link-styleContact"><a href="ContactFormClicked"
runat="server"><span>Email Contact Form</span></a></p>
You can use the
LinkButtoncontrol instead and subscribe to theClickevent.It will appear as a link on the browser and you can have your code in the event handler.
aspx:
Code behind (VB.NET):
Code behind (C#):
Alternatively, you can use the
HtmlAnchorcontrol and set theServerClickevent handler. This is basically theaelement with arunat="server"attribute:aspx:
Code behind (VB.NET):
Code behind (C#):