This is a migrated thread and some comments may be shown as answers.

File Explorer Required

9 Answers 188 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Aamir
Top achievements
Rank 1
Aamir asked on 05 Aug 2008, 01:16 AM
Hi,

I have just bought a suite of telerik controls, so i am new in it.

I need 'File Explorer' to explore my 'Directories' and 'Files' on webserver.  I found 'Vista File Explorer' application in code library but it is for windows form.

I need explorer for web forms which open folders and files on my webserver pointing to specific directory. I require to select a file and put file name in textbox of my form.

Hope to hear your response quickly.

Aamir

9 Answers, 1 is accepted

Sort by
0
Shaun Peet
Top achievements
Rank 2
answered on 05 Aug 2008, 03:37 AM
Hello Aamir,

I suggest that you have a look at the FileManagers that are built into the RadEditor.  In particular, the ImageManager and the DocumentManager; the online demos are here:

http://www.telerik.com/demos/aspnet/prometheus/Editor/Examples/FileManagers/DefaultCS.aspx

These FileManagers provide a ton of functionality right out of the box - including the ability to upload files if needed.  In addition, the FileManagers are independant controls that are part of the Editor, but can be used separately if needed.

Please have a look at these examples and let me know if that's what you're after.  If you are, then I can provide instructions for how to use a FileManager without having an Editor on the page.

Shaun.
0
Aamir
Top achievements
Rank 1
answered on 07 Aug 2008, 01:58 AM
Hi Shaun,

Thank you for your reply.

I have already gone through with those examples, what i thought before that those filemanager controls are part of Editor control, we cann't use standalone.

Yes, by using these filemanager controls as standalone control , i'll fullfil my requirement. I tried to use filemanager with editor control, working fine but don't know how to use them standalone as seperate Controls.

Can you please guide me, how should i use these controls without Editor (if you give me small working code, will help me alot) ?

following is my requirement in web page:

I need to select specific folder from my website which shows all files in it, Which i can set with filemanger Now. What i need you to help me in it that when user will select a file, how  filemanager will return me the file name. if you give me code example for that ... it would be very helpful.

Hope to hear you fast.

Thanks

Aamir

0
Shaun Peet
Top achievements
Rank 2
answered on 07 Aug 2008, 02:51 AM
Hello Aamir,

There's a few steps to get it to work, but it's worth the effort.  In your aspx / ascx page, add a dialog opener control (it's a "hidden" control within the Telerik suite), like so:

<telerik:DialogOpener runat="server" ID="DialogOpener1" />

Then you will need to setup the dialog opener in the Page_Load event in your code-behind (it cannot be done declaratively):

Dim dp As New Editor.DialogControls.FileManagerDialogParameters
dp.ViewPaths =
New String() {"~/YourRootFolder"}
dp.UploadPaths =
New String() {"~/YourRootFolder"}
Dim dm As New DialogDefinition(GetType(Telerik.Web.UI.Editor.DialogControls.DocumentManagerDialog), dp)
dp.MaxUploadFileSize = 1 * 1024 * 1024
' 1MB
dm.ClientCallbackFunction = "set_File"
dm.Width = Unit.Pixel(694)
dm.Height = Unit.Pixel(440)
doIM.DialogDefinitions.Add(
"DocumentManager", dm)


As you can see, this sets a "callback function" which is triggered when a file is selected in the dialog.  This client-side function will need to be on the page that is used to open the file manager.

function set_File(sender, args) {
  var selectedFile = args.SelectedItem; 
  var path = selectedFile.getPath();
}

You can use this path as needed.  Note that at this point it will be the full path to the file.

Hope that helps,

Shaun.
0
Aamir
Top achievements
Rank 1
answered on 07 Aug 2008, 04:57 AM
Hi Shaun,

Thanks for replying me fast.

Can you please write C# code for me, i am not good with VB.net code ? i know, it don't make sense .... but if you can.

Same code will work for "TemplateManager", isn't it?

Only for following

Dim dp As New Editor.DialogControls.FileManagerDialogParameters
dp.ViewPaths =
New String() {"~/YourRootFolder"}
dp.UploadPaths =
New String() {"~/YourRootFolder"}
Dim dm As New DialogDefinition(GetType(Telerik.Web.UI.Editor.DialogControls.DocumentManagerDialog), dp)
dp.MaxUploadFileSize = 1 * 1024 * 1024
' 1MB
dm.ClientCallbackFunction = "set_File"
dm.Width = Unit.Pixel(694)
dm.Height = Unit.Pixel(440)
doIM.DialogDefinitions.Add(
"DocumentManager", dm) 

Aamir

0
Shaun Peet
Top achievements
Rank 2
answered on 07 Aug 2008, 02:18 PM
Hello Aamir,

Yes, it's basically the same for the TemplateManager; just replace everywhere where it uses DocumentManager with TemplateManager.

There is a very good VB -> C# and C# -> VB conversion tool provided by Telerik, available at www.codechanger.com.  It doesn't seem to work for my code below though, so here's my attempt at it, using the TemplateManager instead:

Editor.DialogControls.FileManagerDialogParameters dp = new Editor.DialogControls.FileManagerDialogParameters();
dp.ViewPaths = new string[] {"~/YourRootFolder"}
dp.UploadPaths =  new string[] {"~/YourRootFolder"}
DialogDefinition dm = new DialogDefinition(typeof(Telerik.Web.UI.Editor.DialogControls.TemplateManagerDialog),dp);
dp.MaxUploadFileSize = 1 * 1024 * 1024;
dm.ClientCallbackFunction = "set_File";
dm.Width = Unit.Pixel(694);
dm.Height = Unit.Pixel(440);
// Forgot to explain the following line last time
// The "doIM" should have been "DialogOpener1"
DialogOpener1.DialogDefinitions.Add("TemplateManager",dm);

I also forgot to mention in my last post how to get the FileManager to open in the first place.  This is done using a client-side function on the page like so:

function OpenFileManager() { $find('<%= DialogOpener1.ClientID %>').open('TemplateManager'); }

So then you'll just need to set the onclick attribute of a button or anchor to be "OpenFileManager" to trigger the opening.

Shaun.

0
Aamir
Top achievements
Rank 1
answered on 08 Aug 2008, 05:23 AM
Hi Shaun,

Thank you very much for your help.

I have created a test page to check imageManager. It is working fine if i use "View in Browser" option of visual studio. As soon as i try to build a project, it shows me following error

Error 2 Element 'DialogOpener' is not a known element. This can occur if there is a compilation error in the Web site. 
\testMasterPage.master 41 18 D:\...\admin\

i have added the following in my page

<%

@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>

i check the telerik file manager example,  it says following

  1. by clicking on the Smart Tag of the RadEditor control in Visual Studio. Note that the smart tag will appear only if you have the Telerik.Web.Design.dll file in your project's bin folder or in the GAC.

I don't have telerik.web.design.dll , i have purchased the full suite of telerik controls, it contain Telerik.web.UI.dll and Telerik.charting.dll.

Please help me to solve this build error or mine, i would be thankful of you.

Aamir

0
Shaun Peet
Top achievements
Rank 2
answered on 08 Aug 2008, 04:58 PM
Hello Aamir,

I'm making a sample project right now and will post it somewhere shortly.  I will also submit it to the code library.

Shaun.
0
Accepted
Shaun Peet
Top achievements
Rank 2
answered on 08 Aug 2008, 06:20 PM
Hello Aamir,

I've created a sample project that should be useful for you.  It's available here:

www.microagebasics.com/support/temp/standalonefilemanagers.zip

Please note that it has the TRIAL version of the Telerik.Web.UI.dll in the Bin folder.  I will post this to the code library today as well.

Shaun.
0
Aamir
Top achievements
Rank 1
answered on 13 Aug 2008, 01:05 AM
Hi Shaun,

I am thankful of you for your help on time.

Aamir
Tags
General Discussions
Asked by
Aamir
Top achievements
Rank 1
Answers by
Shaun Peet
Top achievements
Rank 2
Aamir
Top achievements
Rank 1
Share this question
or