Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Window > Open FIleExplorer
RadControls for ASP.NET are no longer supported (see this page for reference). In case you have inquiries about the Telerik ASP.NET AJAX controls, post them in the pertinent ASP.NET AJAX forums.

Not answered Open FIleExplorer

Feed from this thread
  • Posted on May 24, 2011 (permalink)

    Ok here is something I have not been able to figure out yet.

    I have a radgrid that has a EditForm in this form I have a tex box and a button that when the user presses the button it will open the File Explorer allow the user to upload, or select a file and on close it will populate the textbox with the filelocation.

    <EditFormSettings EditFormType="Template">
                    <EditColumn UniqueName="EditCommandColumn1">
                    </EditColumn>
                    <FormTemplate>
                        <table>
                          ...
                            <tr>
                                <td>
                                    Logo:
                                </td>
                                <td>
                                    <asp:TextBox ID="tbLogo" runat="server" Text='<%# Bind("Logo") %>' />
                                    <asp:Button ID="btnLogoLoad" runat="server"  OnClientClick="OpenFileExplorerDialog(); return false;" 
                                        Text="Open... " />
                                </td>
                            </tr>
                            ...
                            <tr>
                                <td align="right" colspan="2">
                                    <asp:Button ID="btnUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'
                                        runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'>
                                    </asp:Button
                                    <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False"
                                        CommandName="Cancel"></asp:Button>
                                </td>
                            </tr>
                        </table>
                    </FormTemplate>
                </EditFormSettings>

    <script type="text/javascript">
          var txtID = null;
          function OpenFileExplorerDialog() {
                
              debugger
              var wnd = $find("<%= ExplorerWindow.ClientID %>");
              wnd.show();
          }
          //This function is called from the Explorer.aspx page
          function OnFileSelected(wnd, fileSelected) {
              // Test:
              // Tova mi triabva               
              var textbox = $get(txtID);
              textbox.value = fileSelected;
          }
            </script>
      
      
          <telerik:RadWindow ID="ExplorerWindow" ReloadOnShow="false" Behavior="Close, Move"
                    runat="server" Modal="true" Height="515px" Width="725px" ShowContentDuringLoad="false"
                    Style="display: none;" VisibleStatusbar="false" NavigateUrl='<%# "Explorer.aspx?Logo="  %>'  Behaviors="Close, Move" />

    How can I pass the current logo file value into the radwindow with the file explorer on it.  I want to be able to select it by default and show it in a preview panel when the screen loads.

    Also how do you set the files select to the textbox inside the editform.

    var textbox = $get(tbLogo);
    does not work.

  • Marin Bratanov Marin Bratanov admin's avatar

    Posted on May 26, 2011 (permalink)

    Hello Eric,

    I am not sure what your scenario is and the provided code snippets are not sufficient to get the concept of your logic.

    What I can suggest at this point is the following:

    • If you have your logo somewhere in the main page/grid you should be able to extract it on the client side via JavaScript (it could be the value of a textbox already, I can't say for sure)
    • after you have this information you can construct the NavigateUrl property of the RadWindow on the client as well (by concatenating your existing URL (Explorer.aspx?Logo=) with the information you get from your grid/textbox) and use the RadWindow's setUrl() method to pass it to the page you load inside
    • As for the textbox - I would recommend injecting the textbox's ClientID from the server in the OnItemCreated event and storing it in a hidden field, so that you can access it via JavaScript

    Based on my assumptions I created a simple page illustrating this approach. Here is a video from my experiment: http://screencast.com/t/rw7uCKYR. The logic I use to get the textbox value can be used to set it as well. I have omitted the page loaded in the RadWindow as I do not have information on your custom logic there, but having the old value in the querystring you should be able to use it. An example how to set the initial item selected is available in the following online demo: http://demos.telerik.com/aspnet-ajax/fileexplorer/examples/server-sideapi/initialpathandpaging/defaultcs.aspx.

    You can find my test page attached as a reference for your further development. I hope it helps.


    Kind regards,
    Marin
    the Telerik team

    Consider using RadControls for ASP.NET AJAX (built on top of the ASP.NET AJAX framework) as a replacement for the Telerik ASP.NET Classic controls, See the product support lifecycle here.

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Window > Open FIleExplorer