473,396 Members | 1,773 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,396 software developers and data experts.

Generate a link in the c# code

I'm buiding a class that pick the files in a directory and shows in the
browser the links to download these files...
But i have to create the hyperlinks, and that part is not working...
I do the folow in the page_Load:

DirectoryInfo dir = new DirectoryInfo(@"e:\shared files");

FileInfo[] files = dir.GetFiles();

foreach(FileInfo file in files)

{

HyperLink HL=new HyperLink();

HL.Text=file.Name.ToString();

HL.NavigateUrl=file.ToString();

}

But the hyperlinks doesn't show in the browse...

Can someone help me??
[]s...
Nov 18 '05 #1
5 1777
you have to add the controls to the form. to control where they appear,
generally you use a placeholder control, then add to its control collection.

-- bruce (sqlwork.com)

"Ricardo" <r_******@hotmail.com> wrote in message
news:et**************@TK2MSFTNGP12.phx.gbl...
| I'm buiding a class that pick the files in a directory and shows in the
| browser the links to download these files...
| But i have to create the hyperlinks, and that part is not working...
| I do the folow in the page_Load:
|
| DirectoryInfo dir = new DirectoryInfo(@"e:\shared files");
|
| FileInfo[] files = dir.GetFiles();
|
| foreach(FileInfo file in files)
|
| {
|
| HyperLink HL=new HyperLink();
|
| HL.Text=file.Name.ToString();
|
| HL.NavigateUrl=file.ToString();
|
| }
|
| But the hyperlinks doesn't show in the browse...
|
| Can someone help me??
|
|
| []s...
|
|
Nov 18 '05 #2
he mean something like
myPlaceHolder.Controls.Add(HL);

"bruce barker" <no***********@safeco.com> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
you have to add the controls to the form. to control where they appear,
generally you use a placeholder control, then add to its control
collection.

-- bruce (sqlwork.com)

"Ricardo" <r_******@hotmail.com> wrote in message
news:et**************@TK2MSFTNGP12.phx.gbl...
| I'm buiding a class that pick the files in a directory and shows in the
| browser the links to download these files...
| But i have to create the hyperlinks, and that part is not working...
| I do the folow in the page_Load:
|
| DirectoryInfo dir = new DirectoryInfo(@"e:\shared files");
|
| FileInfo[] files = dir.GetFiles();
|
| foreach(FileInfo file in files)
|
| {
|
| HyperLink HL=new HyperLink();
|
| HL.Text=file.Name.ToString();
|
| HL.NavigateUrl=file.ToString();
|
| }
|
| But the hyperlinks doesn't show in the browse...
|
| Can someone help me??
|
|
| []s...
|
|

Nov 18 '05 #3
Add
//this refers to the form
this.Controls.Add(HL);

"Ricardo" wrote:
I'm buiding a class that pick the files in a directory and shows in the
browser the links to download these files...
But i have to create the hyperlinks, and that part is not working...
I do the folow in the page_Load:

DirectoryInfo dir = new DirectoryInfo(@"e:\shared files");

FileInfo[] files = dir.GetFiles();

foreach(FileInfo file in files)

{

HyperLink HL=new HyperLink();

HL.Text=file.Name.ToString();

HL.NavigateUrl=file.ToString();

}

But the hyperlinks doesn't show in the browse...

Can someone help me??
[]s...

Nov 18 '05 #4
Thx...

But how can I put one link per line???
"Tarun" <Ta***@discussions.microsoft.com> wrote in message
news:53**********************************@microsof t.com...
Add
//this refers to the form
this.Controls.Add(HL);

"Ricardo" wrote:
I'm buiding a class that pick the files in a directory and shows in the
browser the links to download these files...
But i have to create the hyperlinks, and that part is not working...
I do the folow in the page_Load:

DirectoryInfo dir = new DirectoryInfo(@"e:\shared files");

FileInfo[] files = dir.GetFiles();

foreach(FileInfo file in files)

{

HyperLink HL=new HyperLink();

HL.Text=file.Name.ToString();

HL.NavigateUrl=file.ToString();

}

But the hyperlinks doesn't show in the browse...

Can someone help me??
[]s...

Nov 18 '05 #5
this.Controls.Add(HL);
Literal l = new Literal();
l.Text = "<br/>\n";
this.Controls.Add(l);

"Ricardo" <r_******@hotmail.com> wrote in message
news:eK**************@TK2MSFTNGP09.phx.gbl...
Thx...

But how can I put one link per line???
"Tarun" <Ta***@discussions.microsoft.com> wrote in message
news:53**********************************@microsof t.com...
Add
//this refers to the form
this.Controls.Add(HL);

"Ricardo" wrote:
> I'm buiding a class that pick the files in a directory and shows in the
> browser the links to download these files...
> But i have to create the hyperlinks, and that part is not working...
> I do the folow in the page_Load:
>
> DirectoryInfo dir = new DirectoryInfo(@"e:\shared files");
>
> FileInfo[] files = dir.GetFiles();
>
> foreach(FileInfo file in files)
>
> {
>
> HyperLink HL=new HyperLink();
>
> HL.Text=file.Name.ToString();
>
> HL.NavigateUrl=file.ToString();
>
> }
>
> But the hyperlinks doesn't show in the browse...
>
> Can someone help me??
>
>
> []s...
>
>
>


Nov 18 '05 #6

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

Similar topics

9
by: Fred | last post by:
Hi, I'm sure there are a bunch of them, but googling just returned full-fledged CMS that require a DBMS and generate dynamic pages. I'd just like a script that would 1. look in a directory...
2
by: Matt | last post by:
Hello, I would like to generate what I call an "overall class hierarchy" in UML automatically derived from my C++ code source. An example of what I seek: ...
29
by: Lauren Wilson | last post by:
Does anyone know how the following info is extracted from the user's computer by a Front Page form? HTTP User Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107...
0
by: Ed Eichman | last post by:
Hi Everyone, Is it possible to generate, in code, exactly (or close to it) the detailed error page generated by (IIS? ASP.NET? .NET Framework?) when an exception is thrown in a ASP.NET web...
0
by: sonic | last post by:
I am working with a 3rd party control that does not follow the asp.net event model. I would like to make it post to current page, and fire a server side event. I would like to mimic the behavior...
22
by: Roberto Gori | last post by:
Hi all, i'm looking for a way, a tool or a macro like this: USEFULMACRO(foo, bar, type1 arg1, type2 arg2, ..., typeN argN) to generate the following code: void foo(type1 arg1, type2...
1
by: firenet | last post by:
21 function js_reply_msg(node,g_id,u_id,par_id) 22 { 23 node.innerHTML="<FORM><TEXTAREA name=\"msg_con\"><\/TEXTAREA><br><INPUT type=\"submit\" value=\"reply\"><\/FORM>" 24 ...
4
by: Mike Logan | last post by:
I would like to dynamically create a Visio diagram from .Net. I tried looking at the Visio SDK, but the samples are extremely convoluted for me to understand. Does someone have an example of...
1
by: John Q. Adams | last post by:
I want to generate an XML file on the server side and allow the user to download it by clicking on a link. I also want the XML file to always be named "Config.XML" Whats the best way to do this?...
23
by: Geoff Cox | last post by:
Hello, Is it possible to use php to generate different menus for users who have access to files in different folders? For example, user Fred might be able to access files in folders A, B and...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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
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,...

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.