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

Browser Sub-Directories

A ListBox lists all the folders & files existing in a directory named
'MyDir' on the server. Assume that the ListBox lists 2 directories -
'Dir1' & 'Dir2' i.e. these 2 directories reside in the 'MyDir'
directory. Both 'Dir1' & 'Dir2' also house sub-directories & files.
Assume that the sub-directory 'Dir1' has 3 directories & 3 files.

When a user comes to a ASPX page for the first time, the ListBox lists
all the directories & files existing in 'MyDir'. As expected, the
ListBox also lists the 2 sub-directories 'Dir1' & 'Dir2'.

What I want is when a user selects, say, 'Dir1' from the ListBox &
clicks a Button, then the ListBox should now list the directories &
files existing in 'Dir1' so that the user can view all the directories
& files residing in 'Dir1'.

How do I do this?

Jan 9 '07 #1
1 1665
Hi,

rn**@rediffmail.com wrote:
A ListBox lists all the folders & files existing in a directory named
'MyDir' on the server. Assume that the ListBox lists 2 directories -
'Dir1' & 'Dir2' i.e. these 2 directories reside in the 'MyDir'
directory. Both 'Dir1' & 'Dir2' also house sub-directories & files.
Assume that the sub-directory 'Dir1' has 3 directories & 3 files.

When a user comes to a ASPX page for the first time, the ListBox lists
all the directories & files existing in 'MyDir'. As expected, the
ListBox also lists the 2 sub-directories 'Dir1' & 'Dir2'.

What I want is when a user selects, say, 'Dir1' from the ListBox &
clicks a Button, then the ListBox should now list the directories &
files existing in 'Dir1' so that the user can view all the directories
& files residing in 'Dir1'.

How do I do this?
You have two things to consider:

1) How does the client react when the user clicks on Dir1?
2) What does the server have to do?

1) On the client, the easiest way is to post a request to the server,
and to refresh the page. It's the easiest because you don't have to do
anything, ASP.NET does the work for you. If you set AutoPostBack = true,
clicking on the ListBox will automatically generate a POST for you.

2) On the server, the easiest way is to use the ListBox'
SelectedIndexChanged event. In your event handler, you can then modify
the content of the ListBox. To get the list of directories and files for
Dir1, you can simply use the same way you did for MyDir.

An alternative is to use a web service to do this without refreshing the
page, however the logic becomes more complex on the client. In that
case, you must use JavaScript to modify the content of the ListBox (on
the client, a ListBox is rendered by a SELECT control).

HTH,
Laurent
--
Laurent Bugnion [MVP ASP.NET]
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Jan 10 '07 #2

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

Similar topics

17
by: gokul | last post by:
Hi, Iam a newbie to dotnet and I experience problems in using the Browser control in VB .net. Though Iam able to use it with its basic features, I need to customise it. ...
24
by: Nancy Drew | last post by:
hi all i'm trying to keep users from being able to login to a site twice at the same time. everytime a user does a login, i stick their userID into an application scoped array. if they try to...
2
by: david | last post by:
(1) How do I update the IE browser's status bar from within an ASP.NET web application? (2) How can I capture the event of closing the IE browser from within an ASP.NET web application? (3)...
17
by: lawrence | last post by:
How is it possible that the question "How do I detect which browser the user has" is missing from this FAQ: http://www.faqts.com/knowledge_base/index.phtml/fid/125 and is only here on this...
8
by: Joe Johnston | last post by:
I need a Browser Helper object written in VB.NET Please point me at a good example. Joe MCPx3 ~ Hoping this MSDN ng three day turnaround is true. Additional info: What is a BHO? In its...
8
by: Robert | last post by:
I am creating a small help browser. It is pretty much finished except I cannot find how to pass a file to it (i.e. browser.exe index.html, or any html file, and the html file opens in the browser)...
16
by: Alex Clark | last post by:
Hi All, I'm sure this must have been asked a million times due to it's usefulness, but are there any sensible solutions for disabling right click (and other services such as Ctrl+P, Browser...
15
by: tshad | last post by:
I was looking for a way to handle refreshes (user pressed refresh button) and found a piece of code to check if a Web page was refreshed but I can't get it to work. The code is:...
2
by: Samusiren | last post by:
Hi there, i am currently trying to create a web browser within Visual Basic 6 but the problem i am having is that i want the program to execute a web address upon pressing the enter key (the web...
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:
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
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
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,...
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...

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.