|
Rank: Member Groups: Member
Joined: 3/11/2009 Posts: 24
|
I have a webform with a browse button that calls a file explorer control located on another web form via the FileExplorerHolder. I need to set the rootfolder of the file explorer from the calling page so it will show only an specific folder. Please in vb.net/java
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, You would usually pass additional argument to the actual page through the holder's Url property. For example, instead of having:
Code: HTML/ASPX
<eo:FileExplorerHolder url="Explorer.aspx" ....>
....
</eo:FileExplorerHolder>
You can have:
Code: HTML/ASPX
<eo:FileExplorerHolder url="Explorer.aspx?something=whatever" ....>
....
</eo:FileExplorerHolder>
You would then write code inside your Explorer.aspx.vb's to check this "something" argument and act accordingly. The sample project also contains such code: Go to Demos\File Explorer\Explorer.aspx.vb and then take a look of the Page_Load handler. The sample code checks whether an additional argument "eo_editor_browseFile_profile" has been passed in, and if it sees its value is "image", the code then change the FileExplorer control's AllowedExtension. You would change this to check for your own argument name/value and then modify the FileExplorer's RootFolder property. Thanks!
|
|
Rank: Member Groups: Member
Joined: 3/11/2009 Posts: 24
|
Thanks for your reply. I made the changes. Now , the Dialog and FileExplorerHolder loaded when the page where they are is loaded, so if i want to change the root folder of the fileExplorer based on a selection of a combolist box, the FileExplorer is not changing because is already created in memory. How i refresh the values for an already loaded control on client site. or need to do a postback for that?
Thanks
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
There are two page involved here, let's say A and B. A is the one with combolist box and FileExplorerHolder in, B is the one with the FileExplorer in (thus FileExplorerHolder in A points to B). When user selects an item from combolist box, A should post back, which always refresh the page. So refreshing A should not be an issue.
B will not automatically refresh itself. You can turn off the page cache so that it will be requested from server each time you show it. There are a number of ways to turn off cache for an ASP.NET page. You can Google ASP.NET page caching and you should be able to find plenty of information for that.
Thanks!
|
|
Rank: Member Groups: Member
Joined: 3/11/2009 Posts: 24
|
Thanks. I was trying to avoid the postback when the combolist box value change. I was passing the actual combolist box value to form B when the browse button on form A is clicked. So is not a way to recreate the FileExplorer control everytime the Browse button is Clicked? What about forcing the reload command on the control when clicking the Browse button?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
I am not sure if I got your question correctly. In order to have your FileExplorer to show a different RootFolder, you will have to change FileExplorerHolder.Url property. This is a server side property. You said you got it working in your previous email, how did you change that server property without posting back your page?
|
|
Rank: Member Groups: Member
Joined: 3/11/2009 Posts: 24
|
It's working when the page loads for the first time. But if i change the combolist box value on form A and press the Browse button the rootfolder on form B is not changing to the new value. Now I know is because i need to do a postback to refresh/recreate the File Explorer control. I was asking if was possible to do this without doing a postback to the server. I think i will put the dialog on a panel and refresh the panel only when the combolist box value change. Do you think is a good idea or is better to postback the complete form A?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Putting it in an UpdatePanel/CallbackPanel and then update the panel only is fine. That also does a postback. The difference is not whether you have a postback or not. It's after the postback, whether the full page is updated or only the Panel is updated. As long as you have a postback it's fine.
|
|
Rank: Member Groups: Member
Joined: 3/11/2009 Posts: 24
|
I will try that. Thanks for your help.
|
|
Rank: Member Groups: Member
Joined: 3/11/2009 Posts: 24
|
I did it. The postback of the update panel occurs. Other asp controls on the updatepanel were re-created but the eo:Dialog and the other eo controls in it were not recreated. Any idea?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
Can you create a test page that includes just the list box, UpdatePanel, dialog and FileExplorer holder so that we can take a look? Make sure the test page does not rely on anything else because we will need to be able to run it in order to investigate.
Thanks!
|
|
Rank: Member Groups: Member
Joined: 3/11/2009 Posts: 24
|
I finally work aound this problem. Now the problem i have is the following: When I run the webpage that calls the file explorer window, on my machine (ASP.NET Development server) the path returned for the selected files is: (Ex. file is on c:\dotnet\webapp\virtualfolders\myfile.jpg -> File explorer is returning virtualfolders/myfile.jpg because I setup the rootfolder property to ~/virtualfolder). When I runt the same webpage on IIS Server with the same directory structure, file explorer is returning webapp/virtualfolders/myfile.jpg (rootfolder = ~/virtualfolder). Why is that happening?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
That is normal. The FileExplorer always give you a path that you can use to access the file. In your case, the correct path to the file is webapp/virtualfolders/myfile.jpg on your IIS server. You do not need to the "webapp" path on your dev machine because your dev machine runs Visual Studio Development Server and your app is the only app running on VS Development Server.
|
|
Rank: Member Groups: Member
Joined: 3/11/2009 Posts: 24
|
reson of my question is that i'm addint the Request.ServerVariables("APPL_PHYSICAL_PATH") to the path returned from file explorer and on my developmet works fine and on IIS is adding twice the webapp directory. Request.ServerVariables("APPL_PHYSICAL_PATH") returns : "c:\dotnet\webapp\" and file explorer is returning: webapp/virtualfolders/myfile.jpg. Adding both togther is ended with c:\dotnet\webapp\webapp\virtualfolders\myfile.jpg. Folder doesn't exist. What is the way around to make it working on both environments.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
You should never combine APPL_PHYSICAL_PATH and the path returned by FileExplorer together because the path is based on your server, not your application, where APPL_PHYSICAL_PATH represents your application's root, not your server's root.
To get the physical file path, call MapPath. MapPath should handle the difference for you and always return you the correct full physical file name.
Thanks
|
|