I would like to create a VB.net function, that builds a dynamic hyperlink
using System.Web.UI.WebControls.HyperLink, but I can not find any examples on
how to generate a dynamic hyperlink. Has anyone done this before?
I do not want to dynamically create my hyperlink on an ASP page, but rather
a behind the scenes link that a user can paste into a Word document or Email,
as an embedded link that points to a particular file. This would be similar
to what you might see in the result set of a help context search.
For example, the link might be something like:
http://www.someDomain.com/SomeFile.aspx?fileID=12345
where fileID=12345 (TestFile.doc) is the reference to the File ID on my
database table, and the embedded link name is called "File Name" with the
above URL as the link.
This function will capture the File ID and create this link dynamically when
the user selects the file they want to embed. This user then can paste this
into a Word document or Email seeing only the "File Name". Whoever clicks
that "File Name" will be directed to that page, and open up that File with
the correct program the document is formated in (i.e. Word, Adobe, Excel,
etc.).
This is what I think the function should look like:
Public Function CreateEmbeddedHyperlink(ByVal fileID As Integer, ByVal
fileName As String) As Object
Dim embeddedHyperLink As New System.Web.UI.WebControls.HyperLink
embeddedHyperLink.NavigateUrl =
"http://www.someDomain.com/SomeFile.aspx?fileID=" & fileID
embeddedHyperLink.Text = fileName
Return embeddedHyperLink
End Function