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

File Selector Dialog - Databound Text Box

1 Answer 121 Views
FileExplorer
This is a migrated thread and some comments may be shown as answers.
Brett
Top achievements
Rank 2
Brett asked on 04 May 2009, 06:55 PM
I would like to use the file selector dialog demo to store the file path in a databound text box in a formview.

My current code looks like this.  How can I change it to store the path in my databound file location textbox?

<asp:FormView ID="fvAddBidDoc" runat="server" DataKeyNames="id" DataSourceID="dsAddBidDoc" 
        DefaultMode="Insert">  
 
        <InsertItemTemplate> 
            <table class="style1">  
                <tr> 
                    <td> 
                        Document Number:</td> 
                    <td> 
                        <asp:TextBox ID="DocumentNumberTextBox" runat="server"   
                            Text='<%# Bind("DocumentNumber") %>' /> 
                    </td> 
                    <td> 
                        Document Name:</td> 
                    <td> 
                        <asp:TextBox ID="DocumentNameTextBox" runat="server"   
                            Text='<%# Bind("DocumentName") %>' /> 
                    </td> 
                </tr> 
                <tr> 
                    <td> 
                        Posting Date:  
                        <%--<asp:TextBox ID="PostingDateTextBox" runat="server" Text='<%# Bind("PostingDate") %>' />--%></td>  
                    <td> 
                        <telerik:RadDatePicker ID="PostingDateTextBox" Runat="server"   
                            DbSelectedDate='<%# Bind("PostingDate") %>' Skin="Hay">  
                            <Calendar Skin="Hay" UseColumnHeadersAsSelectors="False"   
                                UseRowHeadersAsSelectors="False" ViewSelectorText="x">  
                            </Calendar> 
                            <DatePopupButton HoverImageUrl="" ImageUrl="" /> 
                        </telerik:RadDatePicker> 
                    </td> 
                    <td> 
                        Closing Date:  
                    </td> 
                    <td> 
                        <telerik:RadDatePicker ID="ClosingDateTextBox" Runat="server"   
                            DbSelectedDate='<%# Bind("ClosingDate") %>' Skin="Hay">  
                            <Calendar Skin="Hay" UseColumnHeadersAsSelectors="False"   
                                UseRowHeadersAsSelectors="False" ViewSelectorText="x">  
                            </Calendar> 
                            <DatePopupButton HoverImageUrl="" ImageUrl="" /> 
                        </telerik:RadDatePicker> 
                    </td> 
                </tr> 
                <tr> 
                    <td> 
                        File Location:</td> 
                    <td> 
                        <asp:TextBox ID="FileLocationTextBox" runat="server"   
                            Text='<%# Bind("FileLocation") %>' /> 
                    </td> 
                    <td> 
                        Select a file:  
                    </td> 
                    <td> 
                        <input ID="fileName" size="50" /><input   
                            onclick="OpenFileExplorerDialog(); return false;" type="button"   
                            value="Open ..." /><br /> 
                        Open the dialog and double click on a file to select it.  
 
                        <script type="text/javascript">  
 
                function OpenFileExplorerDialog() {  
                    var wnd = $find('<%=fvAddBidDoc.FindControl("ExplorerWindow").ClientID %>');  
                    wnd.show();  
                }  
 
                //This function is called from the Explorer.aspx page  
                function OnFileSelected(wnd, fileSelected) {  
                    var textbox = $get("fileName");  
                    textbox.value = fileSelected;  
                }  
            </script> 
 
                    </td> 
                </tr> 
                <tr> 
                    <td> 
                        <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True"   
                            CommandName="Insert" Text="Insert" /> 
                    </td> 
                    <td> 
                        <asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False"   
                            CommandName="Cancel" Text="Cancel" /> 
                    </td> 
                    <td> 
                        &nbsp;</td> 
                    <td> 
                        &nbsp;</td> 
                </tr> 
            </table> 
            <br /> 
              
 
            <telerik:RadWindow runat="server" Width="530px" Height="550px" VisibleStatusbar="false" 
                NavigateUrl="~/bidding/secure/explorer.aspx" ID="ExplorerWindow" Modal="true" 
                Behaviors="Close,Move">  
            </telerik:RadWindow> 
            &nbsp;  
        </InsertItemTemplate> 
    
    </asp:FormView> 

Thanks
Brett

1 Answer, 1 is accepted

Sort by
0
Fiko
Telerik team
answered on 05 May 2009, 03:31 PM
Hi Bslaght,

You can achieve the desired result such as in the online demo, but you need to get a reference to that text box first. This is a common ASP.NET task and for your convenience I pasted the modified OnFileSelected function below :

//This function is called from the Explorer.aspx page   
function OnFileSelected(wnd, fileSelected) 
    var textbox = $get('<%= fvAddBidDoc.FindControl("FileLocationTextBox").ClientID %>'); 
    textbox.value = fileSelected; 
}  

I hope this helps.

All the best,
Fiko
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
FileExplorer
Asked by
Brett
Top achievements
Rank 2
Answers by
Fiko
Telerik team
Share this question
or