I have a HyperLink on my usercontrol in which I set the onlick event dynamically on the server side like this :
this.Attributes["onclick"] = string.Format("javascript:alert('{0}')", base.NavigateUrl);
The problem is that when Asp.net renders the page, it ends up with something like this
<a href='...' onclick="javascript:alert('TEST')>LINK</a>
which obviously is not valid Javascript. Using " instead of ' wouldn't help neither, the generated HTML is alert("TEST")
Is there any way around this?
Thank you.