How to call the Java Script Function when user Click on Hyper link inside the report in ASP .NET?
Question: How to call the Java Script Function when user Click on Hyper link inside the report in ASP .NET?
Answer:
You can write js code in TextObject.Huperlink object(javascript:alert('You clicked!')).
Or write your function into *.aspx(cshtml) file:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="TestInheritReports._Default" %> <%@ Register assembly="FastReport.Web" namespace="FastReport.Web" tagprefix="cc2" %> <script type="text/javascript"> function count_rabbits() { for(var i=1; i<=3; i++) { alert("Pull out from hat rabbit " + i +" !") } } </script> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml">; <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> </div> <cc2:WebReport ID="WebReport1" runat="server" /> </form> </body> </html> |
and call function in hyperlink:
TextObject1.Hyperlink = "javascript:count_rabbits()";