Solved

click on anchor tag - detect in code behind

Posted on 2013-02-05
1
1,513 Views
Last Modified: 2013-02-05
On a web form, when I click on an anchor tag, is there a way I can respond to this event in the code behind, not of the page I am about to go to, but the page that has the anchor tag?
0
Comment
Question by:knowlton
1 Comment
 
LVL 19

Accepted Solution

by:
Daniel Van Der Werken earned 500 total points
Comment Utility
Set the anchor tag to runat="server"

then, in the code behind, work with the .ServerClick() event:

<html>
<a id="myAnchorTag" href="something" runat="server">Click me</a>
</html>

In the .cs:

In the OnInit or Page_Load method:

myAnchorTag.ServerClick() += new SomeEventHandler( object sender, EventArgs e );

Then, of course, you need the implement the event.

Reference: http://msdn.microsoft.com/en-us/library/system.web.ui.htmlcontrols.htmlanchor.serverclick.aspx
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

771 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now