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

Uploading in AjaxPanel problem

3 Answers 92 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Phil
Top achievements
Rank 2
Phil asked on 17 Mar 2010, 03:11 AM
If my upload code is in an AjaxPanel then
If Request.Files.Count > 0 Then 
always return zero, what is causing my problem?
Phil

3 Answers, 1 is accepted

Sort by
0
Accepted
Genady Sergeev
Telerik team
answered on 19 Mar 2010, 01:01 PM
Hello Phil,

RadUpload does not support uploading files inside UpdatePanel/RadAjaxPanel. Please consult with the following help article on how to workaround this problem.

Best wishes,
Genady Sergeev
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
Phil
Top achievements
Rank 2
answered on 22 Mar 2010, 01:44 PM
Hi:
I guest a little more explanation is needed.  I am basing my code on the demo:
Upload / Standard File Inputs
except I only need one file.
So, I am using the html input control to get the file name as follow (slight simplification):
<input type="file" id="feedsUpload" runat="server" name="feedsUpload" size="40" /> 
<br /> 
<asp:LinkButton ID="buttonSubmit" runat="server" Text="Submit" OnClick="feedsUploadButton_Click" /> 
<br /> 
<asp:Label ID="resultsLabel" runat="server" Visible="True" /> 
<br /> 
<telerik:RadProgressArea ID="ProgressArea1" runat="server" /> 
<br /> 
 

If the above is inside a RadAjaxPanel the before mentioned code behind always returns a file count of zero.  If outside a RadAjaxPanel the the count is one but, the progress area does not work.
Note that I am trying not to use the Ajax Toolkit dll.
Phil


0
Phil
Top achievements
Rank 2
answered on 23 Mar 2010, 12:19 AM
Hi
I got the following to work...
Phil
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" %> 
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %> 
<script runat="server"
    protected void feedsUploadButton_Click(object sender, EventArgs e) 
    { 
        // Simulate the feed delay
        System.Threading.Thread.Sleep(2000); 
        if( Request.Files.Count > 0) 
        { 
            string _results = ""
            if (!Object.Equals(UploadedFile.FromHttpPostedFile(Request.Files[feedsUpload.UniqueID]), null)) 
            { 
                _results = UploadedFile.FromHttpPostedFile(Request.Files[feedsUpload.UniqueID]).FileName; 
            } 
            int _i = 1
        } 
    } 
</script> 
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"
</asp:Content> 
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"
    <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server"
        <script type="text/javascript"
         // on upload button click temporarily disables ajax to perform 
         // upload actions 
         function conditionalPostback(sender, args) { 
             if (args.get_eventTarget() == "<%= buttonSubmit.UniqueID %>") { 
                 args.set_enableAjax(false); 
             } 
         } 
        </script> 
    </telerik:RadScriptBlock> 
    <telerik:RadAjaxLoadingPanel ID="feedRadAjaxLoadingPanel"  
        runat="server" Transparency="0" Width="100%" Height="100%" Skin="Default"  
        HorizontalAlign="Center" > 
    </telerik:RadAjaxLoadingPanel> 
    <telerik:RadProgressManager ID="RadProgressManager1" runat="server" /> 
    <telerik:RadAjaxPanel ID="feedRadAjaxPanel" runat="server" Height="200px" Width="300px" 
        LoadingPanelID="feedRadAjaxLoadingPanel" ClientEvents-OnRequestStart="conditionalPostback" > 
        <br /> 
        <input type="file" id="feedsUpload" runat="server" name="feedsUpload" size="40" />  
        <br />  
        <asp:LinkButton ID="buttonSubmit" runat="server" Text="Submit" OnClick="feedsUploadButton_Click" />  
        <br />  
        <asp:Label ID="resultsLabel" runat="server" Visible="True" />  
        <br />  
        <telerik:RadProgressArea ID="ProgressArea1" runat="server" />  
        <br />  
    </telerik:RadAjaxPanel> 
</asp:Content> 
 

Tags
Upload (Obsolete)
Asked by
Phil
Top achievements
Rank 2
Answers by
Genady Sergeev
Telerik team
Phil
Top achievements
Rank 2
Share this question
or