Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

click on anchor tag - detect in code behind

Posted on 2013-02-05
1
Medium Priority
?
1,696 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 2000 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
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 …
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

596 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