RadAsyncUpload not working after triggering UpdatePanel with OnFileUploaded

7 posts, 0 answers
  1. Dave
    Dave avatar
    12 posts
    Member since:
    Mar 2008

    Posted 19 Sep 2013 Link to this post

    I am using an upload control:

    <telerik:RadAsyncUpload runat="server" ID="uxUpload" OnClientFileUploaded="clientFileUploaded"
        MultipleFileSelection="Automatic" TemporaryFolder="~/App_Data/TemporaryFileUpload"
        Skin="" OnFileUploaded="uxUpload_FileUploaded" DropZones=".uploading-section">
    </telerik:RadAsyncUpload>

    with an UpdatePanel:

    <asp:UpdatePanel runat="server" ID="UpdatePanel1" ChildrenAsTriggers="true" UpdateMode="Conditional">
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="uxUpload" EventName="FileUploaded" />
        </Triggers>
        <ContentTemplate>
          stuff
        </ContentTemplate>
    </asp:UpdatePanel>

    After uploading a file (or files), the UpdatePanel is updated, but the RadAsyncUpload's upload button no longer works.  The textbox portion of the upload section is also now a regular textbox (previously clicking it triggered a File dialog).  Is there any javascript I need to run after the UpdatePanel's AJAX response to fix the Upload control?
  2. Hristo Valyavicharski
    Admin
    Hristo Valyavicharski avatar
    975 posts

    Posted 24 Sep 2013 Link to this post

    Hi Dave,

    It seems that similar question has already been discussed in this forum post. Please test the suggested solution.

    Regards,
    Hristo Valyavicharski
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Dave
    Dave avatar
    12 posts
    Member since:
    Mar 2008

    Posted 24 Sep 2013 Link to this post

    Hi Hristo,

    Unfortunately my code does not use a separate button.  I also forgot to include the javascript code to automatically postback after the user uploads a file (through drag+drop or browse):

    function clientFileUploaded(sender, args) {
        __doPostBack('<%= this.uxUpload.ClientID %>', '');
    }

    Otherwise I do use an AsyncPostBackTrigger.  Seems like no matter what I do, the Upload control's Browse button only works once.
  5. Dave
    Dave avatar
    12 posts
    Member since:
    Mar 2008

    Posted 24 Sep 2013 Link to this post

    I found that the "initialize()" function will reset the Upload control and let the browse button work again, but it also has the side effect of causing the drag+drop to double upload the files dragged.
  6. Hristo Valyavicharski
    Admin
    Hristo Valyavicharski avatar
    975 posts

    Posted 25 Sep 2013 Link to this post

    Hi Dave,

    After the uxUpload_FileUploaded event was fired, the RadAsyncUpload must be updated from the server. This will happen only if the RadAsyncUpload is inside the Content Template of the update panel.

    <script type="text/javascript">
        function clientFileUploaded(sender, args) {
            __doPostBack('<%= this.uxUpload.ClientID %>', '');
        }
    </script>

    <asp:UpdatePanel runat="server" ID="UpdatePanel1" ChildrenAsTriggers="true" UpdateMode="Conditional">
        <ContentTemplate>
            stuff
     
            <telerik:RadAsyncUpload runat="server" ID="uxUpload" OnClientFileUploaded="clientFileUploaded"
                MultipleFileSelection="Automatic" Skin="Silk" OnFileUploaded="uxUpload_FileUploaded"
                DropZones=".uploading-section">
            </telerik:RadAsyncUpload>
     
        </ContentTemplate>
    </asp:UpdatePanel>
    Regards,
    Hristo Valyavicharski
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  7. Dave
    Dave avatar
    12 posts
    Member since:
    Mar 2008

    Posted 25 Sep 2013 Link to this post

    Hi Hristo,

    Unfortunately this does not fix the problem.  The Browse button/textbox still do not work after the first upload.

    Thanks,
    Dave
  8. Hristo Valyavicharski
    Admin
    Hristo Valyavicharski avatar
    975 posts

    Posted 30 Sep 2013 Link to this post

    Hi Dave,

    Unfortunately I couldn't manage to replicate the same behavior as you. The pasted code works at my side. Please review the following video.

    I would suggest you to open new support ticket and attach sample project, so I can run and debug it. And I will be able to provide you more detailed information about this problem.

    Regards,
    Hristo Valyavicharski
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017