473,386 Members | 1,883 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Create dynamic Hyperlink


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
3 12333
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

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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Mundungus Fletcher | last post by:
Greetings, I apologize if this has been asked and answered a lot. Googling showed me a few people asking, but I didn't find any clear-cut answers. I have a vendor db, and I need to create a...
2
by: Dave Williamson | last post by:
When a ASPX page is created with dynamic controls based on what the user is doing the programmer must recreate the dynamic controls again on PostBack in the Page_Load so that it's events are wired...
1
by: Gerald Baeck | last post by:
I want to realize a dynamic hyperlink, which changes onclick it's text and it's navigateurl. Unfortunately there is no event for a hyperlink like onclick for buttons. Is there another way to...
2
by: Jason | last post by:
I have a data grid with a hyperlink column. The hyperlink is created by a class that extracts the link from an XML Document. How can I populate the hyperlink column in the data grid with the...
4
by: EvelynAnd Ethan | last post by:
Hi, ItemCommand event not firing from a dynamic user control ,WHERE A DATAGRID HAS BUTTON,when i click on the linkbutton first time the itemcommand event doesnt fire,second time event fires up ...
4
by: BLob | last post by:
Hi, I need to create an RTF document with PHP. Actually, I am using an already created RTF document which with strings like %var% that I replace with $var before sending the document. I need to...
2
by: Dominique | last post by:
Is it possible to change the size of a Dynamic Panel and fix it? Thanks, -- Dominique
1
by: mitramay | last post by:
I am creating a dynamic datagrid. The controls in some of the template columns will have to be generated based on the data contained in them (i.e. the data for that respective DataField column)....
1
by: mcaravinder2008 | last post by:
Hi Masters, Please help me out actually i want to create dynamic controls at run time and want to place them inside the table Code which i have written for testing purpose is as under: for...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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...

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.