how to call javascript from asp.net HyperLink control
asp.net, hyperlink, javascript
Solution
If you use a `LinkButton` instead, you can use the `OnClientClick` property to execute a JavaScript function. Using the `HyperLink` control, you can use the `NavigateUrl` property like this:
<asp:HyperLink ID="Link1" runat="server"
Text="Click Me!"
NavigateUrl="javascript:OpenImage('App_Themes/White/Images/thmb_screenshot_1.png');">
</asp:HyperLink>
Here's an article that discusses it: http://gchandra.wordpress.com/2007/09/27/call-javascript-function-inside/
Problem
I simply want to call a JavaScript function from asp.net hyperlink im using http://orangoo.com/labs/GreyBox/ my requirement is to show thumbnail on hyperlink and on click show full image. Should I use another control? my code is below: ``` <asp:HyperLink ID="Hyperlink" runat="server" CssClass="Screenshot" ImageUrl="App_Themes/White/Images/thmb_screenshot_1.png" NavigateUrl="App_Themes/White/Images/screenshot_1.png" ToolTip="screenshot 1" /> <script language="javascript" type="text/javascript"> //Greybox Image popup window function OpenImage(url) { var caption = "Home"; return GB_showImage(caption, url) } </script> ``` how can I use ``` onclick="OpenImage(this.src); or OnClientClick="OpenImage(this.src); ```