Hi,
I am using the explorer (which is great) as a personal file space and file sharing app for my students to upload and download anywhere.
To stop users uploading and opening executables I need to have EnableOpenFile="false" and then use a seperate button control to initiate the download. This work OK by getting the file name using..
| function OnClientItemSelected(sender, args) |
| { |
| var textbox = $get("fileName"); |
| textbox.value = args.get_path(); |
| } |
And then in the onClick event of the button doing
| Dim filepath As String = Request.Form("fileName") |
| filepath.Replace("/", "\") |
| If Not filepath Is Nothing Then |
| If File.Exists(Server.MapPath(filepath)) Then |
| Dim filename As String = Path.GetFileName(filepath) |
| Response.Clear() |
| Response.ContentType = "application/octet-stream" |
| Response.AddHeader("Content-Disposition", _ |
| "attachment; filename=""" & filename & """") |
| Response.Flush() |
| Response.WriteFile(filepath) |
| Else |
| lblMsg.Text = "No such file exists" |
| End If |
| Else |
| lblMsg.Text = "Please select a file" |
| End If |
I read that we can access the toolbar and context menu using
| function findToolBar() |
| { |
| var oToolBar = $find("<%= FileExplorer1.ToolBar.ClientID %>"); |
| } |
| function findContextMenu() |
| { |
| // Get reference to the RdTreeView's context menu |
| var oTreeViewContexMenu = $find("<%= FileExplorer1.TreeView.ContextMenus[0].ClientID %>"); |
| // Get reference to the RadGrid's context menu |
| var oGridContexMenu = $find("<%= FileExplorer1.GridContextMenu.ClientID %>"); |
but my question (need) is - how can I add either a button to the toolbar or an item to the context menu; or both, that can fire the download event. If at all possible.
Many thanks,
Jon

