troubleshooting Question

How can I fire an OnClick event inside of SVG tags on Text tag? (event in VB code-behind in APS.NET webforms app)

Avatar of sqdperu
sqdperuFlag for United States of America asked on
ASP.NETVisual Basic.NET* SVG
4 Comments1 Solution10 ViewsLast Modified:

Using VS 2017.  ASP.NET / VB.NET Web forms app.

I currently have SVG code in my ASP that will hide/show a hyperlink based on conditions in the VB code-behind.  The code behind also builds and provides the URL for the link.  This code works:

<svg viewBox="0, 0, 1200, 153" preserveAspectRatio="xMinYMin meet"  style="position: absolute" >
   <%-- Various SVG code for Cirles, Lines, and Text --%>         <%-- NOTE: in order to reference in code behind to set visible=false, you must have 'runat="server"' on <a> tag. --%>         <%-- Code behind will supply the URL and hide show link based on criteria. --%>         <a id="lnkDoc" href="." target="_blank" runat="server">                   <text x="738" y="150" text-anchor="start" font-size="11" font-family="sans-serif" text-decoration="underline" fill="#3f48cc" cursor="pointer">                    View doc               </text>         </a> </svg>

Open in new window

Now I no longer can use a hyperlink.  I now need a link button or something that will fire event code in the code-behind based on an on-click event.

I have tried adding an "onclick="DocEvent_Click" to the <text> tag above and that did not work.  I then replaced the <a> tag above with this code:

<a id="lnkDoc" href="." target="_blank" runat="server" visibility="visible">     
       <asp:LinkButton ID="btnDoc" runat="server" x="1055" y="150" Font-Underline="True" OnClick="DocEvent_Click" >View doc</asp:LinkButton>
</a>

Open in new window

It also did not work.  It does not even show the "View doc" text.


What is the easiest way I can add Text inside of the SVG tags that will fire an event in the VB code-behind when clicked?  

(NOTE: I also need to be able to show / hide the text based on a condition in the code- behind.)


Thanks



ASKER CERTIFIED SOLUTION
Log in to continue reading
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform for $9.99/mo
View membership options
Unlock 1 Answer and 4 Comments.
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
The Value of Experts Exchange in My Daily IT Life

Experts Exchange (EE) has become my company's go-to resource to get answers. I've used EE to make decisions, solve problems and even save customers. OutagesIO has been a challenging project and... Keep reading >>

Mike

Owner of Outages.IO
Phoenix, Arizona, United States
Member Since 2016
Join a full scale community that combines the best parts of other tools into one platform.
Unlock 1 Answer and 4 Comments.
View membership options
“All of life is about relationships, and EE has made a virtual community a real community. It lifts everyone's boat.”
William Peck

Member since 2004