I have a solution in which I have created a file upload with the file explorer in a Rad Window as per one of your tutorials. The tutorial works but my solution does not. Can someone see what I have missed.
Please see below for my code.
ASPX
| <%@ Page Language="C#" %> |
| <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %> |
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| <script runat="server"> |
| </script> |
| <html xmlns="http://www.w3.org/1999/xhtml"> |
| <head runat="server"> |
| <style type="text/css"> |
| html, body |
| { |
| margin: 0; |
| padding: 0; |
| } |
| </style> |
| <title></title> |
| </head> |
| <body> |
| <form id="form1" runat="server"> |
| <div> |
| <telerik:RadScriptManager ID="RadScriptManager1" runat="server"> |
| </telerik:RadScriptManager> |
| <telerik:RadFormDecorator DecoratedControls="All" ID="RadFormDecorator1" runat="server" /> |
| <script type="text/javascript"> |
| //A function that will return a reference to the parent radWindow in case the page is loaded in a RadWindow object |
| function getRadWindow() { |
| var oWindow = null; |
| if (window.radWindow) oWindow = window.radWindow; |
| else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow; |
| return oWindow; |
| } |
| function OnClientGridDblClick(sender, args) { |
| var item = args.get_item(); |
| //If file (and not a folder) is selected - call the OnFileSelected method on the parent page |
| if (item.get_type() == Telerik.Web.UI.FileExplorerItemType.File) { |
| args.set_cancel(true); |
| //Get a reference to the opener parent page using rad window |
| var wnd = getRadWindow(); |
| var openerPage = wnd.BrowserWindow; |
| //if you need the URL for the item, use get_url() instead of get_path() |
| openerPage.OnFileSelected(wnd, item.get_path()); |
| //Close window |
| wnd.close(); |
| } |
| } |
| </script> |
| <telerik:RadFileExplorer runat="server" ID="FileExplorer1" VisibleControls="All" |
| Width="530" Height="500" EnableViewState="true" OnClientFileOpen="OnClientGridDblClick" DisplayUpFolderItem="True" |
| Language="en-GB"> |
| <Configuration SearchPatterns="*.*" DeletePaths="~/Uploads" UploadPaths="~/Uploads" |
| ViewPaths="~/Uploads"></Configuration> |
| </telerik:RadFileExplorer> |
| </div> |
| </form> |
| </body> |
| </html> |
