Using the Hyperlink property available on the following ActiveReports controls, you can add hyperlinks that connect to a Web page, open an e-mail, or jump to a bookmark.
Note: When using the HtmlViewer, the RawHtml, the Flash Viewer or the Silverlight Viewer to display a report, you should indicate a full URL address (for example, "http://www.datadynamics.com") for the Hyperlink property. |
The following example shows what the code for the method looks like.
To write the code in Visual Basic.NET
Visual Basic.NET code. Paste INSIDE the Format event. |
Copy Code |
---|---|
Dim iStart As Integer Dim sHTML As String If txtHomePage.Text <> "" Then iStart = InStr(1, txtHomePage.Text, "#", CompareMethod.Text) sHTML = Right(txtHomePage.Text, (Len(txtHomePage.Text) - iStart)) sHTML = Replace(sHTML, "#", "", 1, -1, CompareMethod.Text) txtHomePage.HyperLink = sHTML txtHomePage.Text = Replace(txtHomePage.Text, "#", "", 1, -1, CompareMethod.Text) End If |
To write the code in C#
C# code. Paste INSIDE the Format event. |
Copy Code |
---|---|
int iStart; string sHTML; if (txtHomePage.Text != "") { iStart = txtHomePage.Text.IndexOf("#",0); sHTML = txtHomePage.Text.Substring(iStart, txtHomePage.Text.Length - iStart); sHTML = sHTML.Replace("#", ""); txtHomePage.HyperLink = sHTML; txtHomePage.Text = txtHomePage.Text.Replace("#", ""); } |
The following example shows what the code for the method looks like.
To write the code in Visual Basic.NET
Visual Basic.NET code. Paste JUST ABOVE the Format event. |
Copy Code |
---|---|
Public pBM As New BookmarksCollection() Dim iEntry As Integer |
Visual Basic.NET code. Paste INSIDE the Format event. |
Copy Code |
---|---|
Me.Detail1.AddBookmark(Me.txtCompanyName.Text) Me.txtEntry.HyperLink = "toc://" + pBM(iEntry - 1).Label Me.txtEntry.Text = pBM(iEntry - 1).Label Me.txtPage.Text = pBM(iEntry - 1).PageNumber |
To write the code in C#
C# code. Paste JUST ABOVE the Format event. |
Copy Code |
---|---|
public BookmarksCollection pBM = new BookmarksCollection(); int iEntry; |
C# code. Paste INSIDE the Format event. |
Copy Code |
---|---|
this.detail.AddBookmark(this.txtCompanyName.Text); this.txtEntry.HyperLink = "toc://" + pBM[iEntry - 1].Label; this.txtEntry.Text = pBM[iEntry - 1].Label; this.txtPage.Text = pBM[iEntry - 1].PageNumber.ToString(); |
To display the page number of the bookmark in the table of contents
To write the code in Visual Basic
The following example shows what the code for the method looks like.
Visual Basic.NET code. Paste INSIDE the FetchData event. |
Copy Code |
---|---|
If iEntry > pBM.Count - 1 Then eArgs.EOF = True Else eArgs.EOF = False iEntry += 1 End If |
To write the code in C#
The following example shows what the code for the method looks like.
C# code. Paste INSIDE the FetchData event. |
Copy Code |
---|---|
if (iEntry > pBM.Count - 1) { eArgs.EOF = true; } else { eArgs.EOF = false; iEntry += 1; } |