Solved

click on anchor tag - detect in code behind

Posted on 2013-02-05
1
1,619 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:Tom Knowlton
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 20

Accepted Solution

by:
Daniel Van Der Werken earned 500 total points
ID: 38856051
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

688 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