I was trying to follow the demo for FileExplorer / Filter files and download at http://demos.telerik.com/aspnet-ajax/fileexplorer/examples/filteranddownloadfiles/defaultcs.aspx
But I am not having much luck, so far I place the following script in the <head>
My FileExplorer Looks like this:
And I added this to the code behind:
I am not sure what else to do. It seems the doc to be downloaded will be handled by a handler.ashx file but I cannot see any code for that file.
But I am not having much luck, so far I place the following script in the <head>
| <script type="text/javascript"> |
| //<![CDATA[ |
| function OnClientFileOpen(oExplorer, args) |
| { |
| var item = args.get_item(); |
| var fileExtension = item.get_extension(); |
| // var fileDownloadMode = document.getElementById("chkbxDownoaldFile").checked; |
| if ((true == true) && (fileExtension == "pdf" || fileExtension == "pdf")) |
| {// Download the file |
| // File is a image document, do not open a new window |
| args.set_cancel(true); |
| // Tell browser to open file directly |
| var requestImage = "Handler.ashx?path=" + item.get_url(); |
| document.location = requestImage; |
| } |
| } |
| //]]> |
| </script> |
My FileExplorer Looks like this:
| <telerik:RadScriptManager ID="RadScriptManager1" Runat="server"> |
| </telerik:RadScriptManager> |
| <telerik:RadFileExplorer ID="RadFileExplorer1" Runat="server" onclientfileopen="OnClientFileOpen" |
| DisplayUpFolderItem="True" Skin="Office2007" |
| VisibleControls="TreeView, Grid, Toolbar, ContextMenus" EnableCopy="True"> |
| <Configuration SearchPatterns="*.*" ></Configuration> |
| <Configuration ViewPaths="~/doc_manager_files/" UploadPaths="~/doc_manager_files/" |
| DeletePaths="~/doc_manager_files/" MaxUploadFileSize="204800000" /> |
| </telerik:RadFileExplorer> |
And I added this to the code behind:
| Private Function IsFiltered(ByVal name As String) As Boolean |
| If name.ToLower().EndsWith(".sys") OrElse name.ToLower().Contains("_sys") Then |
| Return True |
| End If |
| Return False |
| End Function |
I am not sure what else to do. It seems the doc to be downloaded will be handled by a handler.ashx file but I cannot see any code for that file.
