By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,836 Members | 2,059 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,836 IT Pros & Developers. It's quick & easy.

Create dynamic Hyperlink

P: n/a

I am working with VS.net 2003, framework 1.1, developing with VB.net,
and ASP.net, and I would like to know how you can create a dynamic
hyperlink on the fly to a document stored in a SQL database?

I would like to create a VB.net function that would do this, and I
found this class *System.Web.UI.WebControls.HyperLink*, but I can not
find any examples on generate a dynamic hyperlink. Basically, I want
my function to generate an embedded hyperlink to a document when a user
clicks on it, and allow that user to insert that embedded link into some
document similar to the embedded hyperlink you may find in a help
search.

If anyone has done this before could you share the information on you
did this. Iíve been programming for 10 years, but I have only been
working with VB.net for about 6 months and this is something new for
me.

Thanks,
--
sloesch
------------------------------------------------------------------------
sloesch's Profile: http://www.hightechtalks.com/m905
View this thread: http://www.hightechtalks.com/t2353539

Feb 6 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
ok,

your description is a little fuzzy there, but if i read it correctly,
you want to dynamically generate a HyperLink control on an asp.net
page.

For this, from your code behind, simply create the new control:

Dim myLink as New System.Web.UI.WebControls.HyperLink;

then set the Navigation URL to whatever address you want to navigate
them to, this could be another page within your app, with a querystring
that does something specific:

myLink.NavigateURL = "somepage.aspx?id=" & someClass.Property;

then you need to add the control to a placeholder or some other form of
container control to be placed on the page:

myPlaceHolder.Controls.Add(myLink);

Here is a link on the MSDN to the HyperLink control:
http://msdn2.microsoft.com/en-us/lib...US,VS.80).aspx

Note: I code in CSharp so I have not tested tha above code, but you get
the idea.

Feb 6 '06 #2

P: n/a

Sorry for the confusion. I may have used the wrong verbiage to describe
what I am doing, so my apology. Like I said, Iím fairly new to .Net.

Your response is close to what I attempting to accomplish, but 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. For
example, the link might be something like:

http://www.testweb.com/DocumentView.aspx?x=2

where x=2 (DocTest.doc) is the reference to the document ID on my
database table and the embedded link name is called Document Test with
the above URL as the linked.

I want my function to capture the document ID and create this link
dynamically when the selects the document they want to embed. This
user then can paste this into a Word document or email seeing only the
*Document Name*. Whoever clicks that Document Name will be directed to
that page, which verifies the document id, and open that document up
with the correct program the document is formated in (i.e. Word, Adobe,
Excel, etc.).
DKode Wrote:
ok,

your description is a little fuzzy there, but if i read it correctly,
you want to dynamically generate a HyperLink control on an asp.net
page.

For this, from your code behind, simply create the new control:

Dim myLink as New System.Web.UI.WebControls.HyperLink;

then set the Navigation URL to whatever address you want to navigate
them to, this could be another page within your app, with a
querystring
that does something specific:

myLink.NavigateURL = "somepage.aspx?id=" & someClass.Property;

then you need to add the control to a placeholder or some other form
of
container control to be placed on the page:

myPlaceHolder.Controls.Add(myLink);

Here is a link on the MSDN to the HyperLink control:
http://msdn2.microsoft.com/en-us/lib...US,VS.80).aspx

Note: I code in CSharp so I have not tested tha above code, but you
get
the idea.

--
sloesch
------------------------------------------------------------------------
sloesch's Profile: http://www.hightechtalks.com/m905
View this thread: http://www.hightechtalks.com/t2353539

Feb 6 '06 #3

P: n/a
ahhh. Ok i think i understand now. This is something that I have
personally never done, although one company wanted me to do something
like this in a word doc. I think the feature in the office suite is
called word templates maybe?

I would search through the MSDN for documents explaining office
automation. I think you'll find what you are looking for in there.

Sorry I don't have more info, but like i said i have never done that
before, but it defintaely sounds possible.

hope this helps!

Feb 6 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.