473,659 Members | 2,690 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1680
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'
SelectedIndexCh anged 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
57379
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. http://www.codeproject.com/books/0764549146_8.asp The above link shows where what I want is achived in C#, but I need t oa cjhive the same in VB .net. Someone help and guidance would be much appreciated.
24
2452
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 login again, i bounce them to an error page. i use the session_onEnd sub within global.asa to remove their userID from the array at the end of their session, and this seems to work fine. however, if i just shut down the browser, the sub_onEnd...
2
309
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) How can I suspend any activity - disable accepting keyboard or mouse clicks on a web page until the client request is processed by an IIS server.
17
2541
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 with a link to old information that suggests use of "navigator": http://developer.irt.org/script/43.htm
8
5726
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 simplest form, a BHO is a COM in-
8
1553
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) from the command line. Pointers would help. : ) Bob
16
9439
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 hotkeys etc) on a Web-Browser control in VB.NET? Despite Googling for ideas on and off for a week now, I only found one solution and this was to implement IMessageFilter on the form and then trap all the incoming messages. Unfortunately, this...
15
1981
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: ************************************************************ Namespace StevenBey.Web.UI Public Class Page Inherits System.Web.UI.Page
2
2524
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 address would be in a text box) I have got the web browser to execute a web address upon selecting it from a drop down list of favorites, this is the only way it will navigate the Internet for me. Here is my code if that helps: - Option...
0
8332
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8525
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8627
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7356
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6179
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4335
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2750
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1975
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.