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

How to make dynamic links?

P: n/a
Hi

I need to make a list of "download file links" on a webpage. All the data
is dynamic - it depends on the user's actions how many files, and which
files, I need to present in the list. The files are identified by an id in
a database.

How do I do this? I was thinking I could somehow make a list of <a href...>
tags which could call a method in my c# code-behind. Is this possible? Or
is there a better way?

The links need to pass a "file id" to my code-behind so I can find the
correct file in a database and supply the file to the user (I assume I use
the Response stream to send the file).

Thanks,
Peter
May 7 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
"Peter K" <xd****@hotmail.comwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
How do I do this?
Sounds like you need a Repeater:
http://www.google.co.uk/search?sourc...%3aRepeater%22
--
http://www.markrae.net

May 7 '07 #2

P: n/a
On May 7, 1:22 pm, Peter K <xdz...@hotmail.comwrote:
Hi

I need to make a list of "download file links" on a webpage. All the data
is dynamic - it depends on the user's actions how many files, and which
files, I need to present in the list. The files are identified by an id in
a database.

How do I do this? I was thinking I could somehow make a list of <a href...>
tags which could call a method in my c# code-behind. Is this possible? Or
is there a better way?

The links need to pass a "file id" to my code-behind so I can find the
correct file in a database and supply the file to the user (I assume I use
the Response stream to send the file).

Thanks,
Peter
there are a lot of ways to do it

as an example (using a DataList Control)

<asp:DataList id="UrlList" runat="server">
<ItemTemplate>
<a href='mypage.aspx?id=<%# DataBinder.Eval(Container.DataItem,
"StringValue") %>'>Click here</a>
</ItemTemplate>
</asp:DataList>

in the code-behind:

UrlList.DataSource = CreateDataSourceOfURLs()
UrlList.DataBind()

May 7 '07 #3

P: n/a
It sounds like you are storing the file information in some form of data
store (database, XML file, search of file system that can be stored in
objects or files). If so, get the information into a DataSet or object
collection that can be bound. As far as how to do the links themselves, a
Repeater is a very good choice, with a Hyperlink in the item template.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com

*********************************************
Think outside the box!
*********************************************
"Peter K" <xd****@hotmail.comwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
Hi

I need to make a list of "download file links" on a webpage. All the data
is dynamic - it depends on the user's actions how many files, and which
files, I need to present in the list. The files are identified by an id in
a database.

How do I do this? I was thinking I could somehow make a list of <a
href...>
tags which could call a method in my c# code-behind. Is this possible? Or
is there a better way?

The links need to pass a "file id" to my code-behind so I can find the
correct file in a database and supply the file to the user (I assume I use
the Response stream to send the file).

Thanks,
Peter
May 7 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.