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

Multiple TextBoxes and File Explorer as Selector

2 Answers 75 Views
FileExplorer
This is a migrated thread and some comments may be shown as answers.
Simon
Top achievements
Rank 1
Simon asked on 04 Mar 2010, 09:55 PM
Dear All,
This is my situation.  I have based my solution on this http://demos.telerik.com/aspnet-ajax/fileexplorer/examples/fileselectordialog/defaultcs.aspx tutorial.  I have created 5 other pages that hold the file explorer for selecting different images.

Please see my code below.  I am trying to populate different text boxes based on different file selectors.  I can only get the last text box to populate with the file path and it ignores all the others.

Any help Please!!!!

<igtab:UltraWebTab ID="UltraWebTab1" runat="server" BorderColor="#949C9C" BorderStyle="Solid" 
            BorderWidth="1px" DisplayMode="Scrollable" Width="400px"  
            ThreeDEffect="False"
            <Tabs> 
                <igtab:Tab Text="Small Product No" Tooltip="Small Product Number"
                    <ContentTemplate> 
                        <fieldset> 
                            <asp:Label ID="Image1Label" runat="server" /><br /> 
                            <asp:TextBox ID="File1" runat="server" /> 
                            <asp:Button OnClientClick="OpenFileExplorerDialog(); return false;" ID="SelectImage1Button" 
                                runat="server" Text="Select" /> 
                            <asp:Button ID="upload1Button" runat="server" Text="Upload" OnClick="upload1Button_Click" /> 
                        </fieldset> 
                    </ContentTemplate> 
                </igtab:Tab> 
                <igtab:Tab Text="Large Product No" Tooltip="Large Product No"
                    <ContentTemplate> 
                        <fieldset> 
                            <asp:Label ID="Label1" runat="server" /><br /> 
                            <asp:TextBox ID="TextBox1" runat="server" /> 
                            <asp:Button OnClientClick="OpenFileExplorerDialog(); return false;" ID="Button2" 
                                runat="server" Text="Select" /> 
                            <asp:Button ID="Button3" runat="server" Text="Upload" OnClick="upload1Button_Click" /> 
                        </fieldset> 
                    </ContentTemplate> 
                </igtab:Tab> 
                <igtab:Tab Text="Product Thumbnail" Tooltip="Product Thumbnail"
                </igtab:Tab> 
                <igtab:Tab Text="Large Product Image 1" Tooltip="Large Product Image 1"
                </igtab:Tab> 
                <igtab:Tab Text="Large Product Image 2" Tooltip="Large Product Image 2"
                </igtab:Tab> 
            </Tabs> 
            <RoundedImage FillStyle="LeftMergedWithCenter" HoverImage="ig_tab_winXPs2.gif"  
                LeftSideWidth="7" NormalImage="ig_tab_winXPs3.gif" RightSideWidth="6"  
                SelectedImage="ig_tab_winXPs1.gif" ShiftOfImages="2" /> 
            <SelectedTabStyle> 
                <Padding Bottom="2px" /> 
            </SelectedTabStyle> 
            <DefaultTabStyle BackColor="GhostWhite" Font-Names="Microsoft Sans Serif"  
                Font-Size="8pt" ForeColor="Black" Height="22px"
                <Padding Top="2px" /> 
            </DefaultTabStyle> 
        </igtab:UltraWebTab> 
 
        <script type="text/javascript"
            function OpenFileExplorerDialog() { 
                var wnd = $find("<%= ExplorerWindow.ClientID %>"); 
                wnd.show(); 
            } 
 
            //This function is called from the Explorer.aspx page 
            function OnFileSelected(wnd, fileSelected) { 
                var textbox = $get("<%= File1.ClientID %>"); 
                textbox.value = fileSelected
            } 
        </script> 
 
        <telerik:RadWindow runat="server" Width="650px" Height="560px" VisibleStatusbar="false" 
            Style="z-index: 101" NavigateUrl="~/Rebecca/FileExplorer/Image1.aspx" ID="ExplorerWindow" 
            Modal="true" Behaviors="Close,Move"
        </telerik:RadWindow> 
         
        <script type="text/javascript"
            function OpenLargeImage() { 
                var wnd = $find("<%= RadWindow1.ClientID %>"); 
                wnd.show(); 
            } 
 
            //This function is called from the Explorer.aspx page 
            function OnFileSelected(wnd, fileSelected) { 
                var textbox1 = $get("<%= TextBox1.ClientID %>"); 
                textbox1.value = fileSelected
            } 
        </script> 
 
        <telerik:RadWindow runat="server" Width="650px" Height="560px" VisibleStatusbar="false" 
            Style="z-index: 101" NavigateUrl="~/Rebecca/FileExplorer/LargeProductNo.aspx" ID="RadWindow1" 
            Modal="true" Behaviors="Close,Move"
        </telerik:RadWindow> 

2 Answers, 1 is accepted

Sort by
0
Fiko
Telerik team
answered on 09 Mar 2010, 01:43 PM
Hi Simon,

The problem comes from the fact that you have more than one JavaScript method with the same name. Please note that in this case the last method will be executed. In your case I recommend you to change the names of the methods for example: OnFileSelected1 and OnFileSelected2. Then in the Explorer.aspx page you need to call the corresponding methods from the parent page (the code from the demo):
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.OnFileSelected1(wnd, item.get_path());
        //Close window
        wnd.close();
    }
}

I hope this helps.

Regards,
Fiko
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Simon
Top achievements
Rank 1
answered on 09 Mar 2010, 01:47 PM
Thank you for pointing that out.  I can't believe I missed something sooo simple.

Simon
Tags
FileExplorer
Asked by
Simon
Top achievements
Rank 1
Answers by
Fiko
Telerik team
Simon
Top achievements
Rank 1
Share this question
or