473,505 Members | 15,626 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Creating a Embedded HyperLink Function

SAL
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
Feb 6 '06 #1
2 4985
DWS
SAL,
Your on the right track but your function will return a string that can be
pasted into the email. Sometimes its better to use the built in controls and
sometimes I can just render html on the fly. I'm rendering html on the fly
here. You just have to work on pasting the string returned from the function
into the email.

Public Function CreateEmbeddedHyperlink(ByVal fileID As Integer, ByVal
fileName As String) As string
dim x as string
x = "<a href=http://www.somedomain.com/somefile.aspx?fileid="
x+=fileid
x+=">"
x+=filename
x+="</a>
return x
end function

Good Luck
DWS

"SAL" wrote:
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

Feb 7 '06 #2
SAL
Thanks DWS,

So, it's better to return a HTML string rather than the Oject?

Thanks,

Sal

"DWS" wrote:
SAL,
Your on the right track but your function will return a string that can be
pasted into the email. Sometimes its better to use the built in controls and
sometimes I can just render html on the fly. I'm rendering html on the fly
here. You just have to work on pasting the string returned from the function
into the email.

Public Function CreateEmbeddedHyperlink(ByVal fileID As Integer, ByVal
fileName As String) As string
dim x as string
x = "<a href=http://www.somedomain.com/somefile.aspx?fileid="
x+=fileid
x+=">"
x+=filename
x+="</a>
return x
end function

Good Luck
DWS

"SAL" wrote:
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

Feb 7 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3377
by: Dixie | last post by:
I wish to add some fields to an existing table in code. I am using the following code from rkc. CurrentDb.Execute ("ALTER TABLE MyTable ADD MyNewField Text 25") This works , but I need to also set...
5
6683
by: Martin Dew | last post by:
Having some problems getting a hyperlink object to work in my repeater control, It displays the text I have asked it to for the hyperlink, but it does not act as a link. My repeater code is below...
1
1848
by: D. Shane Fowlkes | last post by:
Hello All. I keep asking for help with this on the www.asp.net forums and nobody seems to be able to help. What I'm trying to accomplish is very simple. I simply want to create a Hyperlink...
6
2935
by: epigram | last post by:
I'm using the DataGrid with AutoGenerateColumns set to false and choosing which columns I want in the grid by using the <Columns> attribute. What I want to do is to create a hyperlink out of one...
3
15390
by: Tim::.. | last post by:
I currently have the following datagrid but want to turn the name and email column into a hyperlink in the codebehind! Can someone please tell me how I achieve this! Thanks Private Sub...
4
3421
by: mramsay | last post by:
Hi, I'm having a real problem creating a dynamic hyperlink for my website. I want to pull the field name from mysql table. Field name is description. I would like this to be a hyperlink on my...
1
6690
by: leenadiwan | last post by:
Hi All!! We want to create a hyperlink dynamically in an html table TD. We have tried the following and evenon some internet sites the code examples are samilar but the adding to the td part is...
13
42857
ADezii
by: ADezii | last post by:
Recently, there have been several questions and much confusion concerning the Topic of Hyperlinks. Specifically, Users wanted to know how to retrieve a File Name from a FileDialog Box, copy the Name...
6
5651
by: vspsdca | last post by:
Hi, I'm a newbie here and does not really have any formal training on VBA. I just need help to get my hyperlink to work. I have a form in MS Access with a browse button where a user can select a...
0
7216
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7098
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7303
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7018
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7471
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5613
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3187
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3176
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1528
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.