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

RadAsyncUpload Not mainting the count after Radconfirm

5 Answers 87 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kavita
Top achievements
Rank 1
Kavita asked on 09 Jul 2014, 10:17 AM
Hello,

In my project i have used RadAsyncUpload and Rad confirm.
My uploaded files count is not getting maintained after rad confirm appears.
I want to perform insert query after i get a YES from confirm dialog and my validateServiceCallRequirements function returns true.
I m explaining this scenario with small example.
flow is same in my project but a lot of other things are going on.


''''''''''''''''''''''My Upload.vb code''''''''''''''''''''''''''''''''''
    
Partial Class Testing_Upload
    Inherits System.Web.UI.Page
 
    Protected Sub RadAjaxManager1_AjaxRequest(ByVal sender As Object, ByVal e As Telerik.Web.UI.AjaxRequestEventArgs) Handles RadAjaxManager1.AjaxRequest
 
        If e.Argument = "Goback" Then
 
            Call SaveData()
 
        End If
  
    End Sub
 
 
 
    Protected Sub btnSaveServiceCall_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSaveServiceCall.Click
 
        MsgBox(RadAsyncUpload1.UploadedFiles.Count.ToString + " COUNT IS CORRECT")
 
        If validateServiceCallRequirements() = True Then
 
            Call SaveData()
 
        End If
         
    End Sub
 
 
    Protected Function validateServiceCallRequirements() As Boolean
  
        RadWindowManager.RadConfirm("My message", "GoTo", 250, 110, Nothing, "Confirm", "")
         Return False
        Exit Function
  
    End Function
 
    Protected Sub SaveData()
 
        MsgBox(RadAsyncUpload1.UploadedFiles.Count.ToString + "        COUNT IS INCORRECT")
       
    End Sub
 
    Protected Sub Testing_Upload_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
 
        End If
 
    End Sub
End Class



'''''''''''''''''''''''''' Upload.aspx page'''''''''''''''''''''''''''

<%@ Page Language="VB" MasterPageFile="~/InductoServMasterPage.master" AutoEventWireup="false" CodeFile="Upload.aspx.vb" Inherits="Testing_Upload" title="Untitled Page" %>
 
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
       <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Windows7" />
    
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"  DefaultLoadingPanelID="RadAjaxLoadingPanel1" >
        <AjaxSettings>
                                       
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <asp:UpdatePanel ID="UpdatePanelServiceCallRequirements" runat ="server"  EnableViewState ="true"  UpdateMode ="Conditional">
    <ContentTemplate >
                    
 
  <telerik:RadAsyncUpload ID="RadAsyncUpload1" runat="server" skin="Windows7"  Font-Names ="Arial" Font-Size ="14px"  PostbackTriggers ="btnSaveServiceCall" MultipleFileSelection ="Automatic" Width ="300px"   AllowedFileExtensions =".jpg,.png,.jpeg,.gif,.bmp,.doc,.docx,.xls,.xlsx,.txt,.pdf,.ppt,.pptx,.pps,.ppsx,.pot,.potx"     Localization-Select="Browse">
   </telerik:RadAsyncUpload>
 
        <asp:Button id="btnSaveServiceCall" runat="server" Text="Save" UseSubmitBehavior="False" CssClass="btnCustom"></asp:Button>
               
 
</ContentTemplate>
</asp:UpdatePanel>
 
 <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"></telerik:RadCodeBlock>
                     
    <script type="text/javascript" language="javascript">
    
 
function   GoTo(arg)
  {
      if (arg == true )
        {
           $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Goback");
       
      
        }
         
  }
   
  </script>
   
 <telerik:RadWindowManager ID="RadWindowManager" runat="server">
        <AlertTemplate >
                <div>
                    <div class="rwDialogPopup radalert" style="padding-left: 0; font-family :Arial ; font-size :14px ; background: url('../Images/icon/Information.png') no-repeat left center !important;">
                        <div class="rwDialogText" style="margin-left: 50px;  ">
                            {1}
                        </div>
                        <div  style="margin-left: 50px;  ">
                              <a  onclick="$find('{0}').close();" class="rwPopupButton"  href="javascript:void(0);">
                                    <span class="rwOuterSpan">
                                        <span class="rwInnerSpan">##LOC[OK]##
                                        </span>
                                    </span>
                               </a>
                         </div>
                    </div>
                </div>
           </AlertTemplate>
       
      <ConfirmTemplate>
            <div class="rwDialogPopup radconfirm" style =" font-family :Arial ; font-size :14px ; background: url('../Images/icon/Question.png') no-repeat left center !important; ">
              <div class="rwDialogText" >
                    {1}
               </div>
                 <div>
                    <a onclick="$find('{0}').close(true);" class="rwPopupButton" href="javascript:void(0);">
                        <span class="rwOuterSpan">
                            <span class="rwInnerSpan">Yes</span>
                        </span></a>
                    <a onclick="$find('{0}').close(false);"   class="rwPopupButton" href="javascript:void(0);">
                    <span class="rwOuterSpan">
                        <span     class="rwInnerSpan">No</span></span>
                    </a>
                 </div>
            </div>
        </ConfirmTemplate>
            </telerik:RadWindowManager>
</asp:Content>





5 Answers, 1 is accepted

Sort by
0
Boyan Dimitrov
Telerik team
answered on 14 Jul 2014, 10:23 AM
Hi,

I would like to clarify that showing 0 for number of uploaded files when clicking on "Yes" or "No" (confirmation window) is rather expected behavior.

Please note that after you uploaded 3 files for example and click on the "Save" button it will do a post-back to the server. On the server it shows 3 files which is correctly. Then after this post-back ended the files are moved target folder and the RadAsyncUpload control no longer have any uploaded files. So when you click on any button of the confirmation window the uploaded files collection of the RadAsyncUpload is already empty.

Regards,
Boyan Dimitrov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Gioce90
Top achievements
Rank 1
answered on 24 Jan 2016, 08:50 PM

I have the same problem. My wish is: the user can decide if he want upload files clicking YES or NO in the RadConfirm.

But files disappear after postback.

0
Ivan Danchev
Telerik team
answered on 25 Jan 2016, 05:55 PM
Hello,

Please try the following code snippet. The selected files should not be cleared until the upload button is pressed, when they will be moved to the Target folder ("Uploads") located in the application's root folder:
<telerik:RadWindowManager runat="server" ID="RadWindowManager1"></telerik:RadWindowManager>
<div>
    <script type="text/javascript">
        function confirmCallBackFn(arg) {
            $telerik.$("#Button1").show();
        }
    </script>
 
    <telerik:RadAsyncUpload runat="server" ID="RadAsyncUpload1"
         MultipleFileSelection="Automatic" TargetFolder="~/Uploads" PostbackTriggers="Button1"></telerik:RadAsyncUpload>
 
    <button onclick="radconfirm('Do you want to upload the file?', confirmCallBackFn); return false;">
        show radconfirm</button>
 
    <asp:Button runat="server" ID="Button1" Text="Upload" Style="display: none;"></asp:Button>
</div>


Regards,
Ivan Danchev
Telerik
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 Feedback Portal and vote to affect the priority of the items
0
Gioce90
Top achievements
Rank 1
answered on 26 Jan 2016, 09:15 AM

I noticed that my problem is pretty different.

 need to take a look on the size of the file and, if this is greater then X bytes... so must show a radConfirm.

To do this I use AJAX and server-side code. But in this way I loose the persistence of the file.

 I descrive my problem here: http://www.telerik.com/forums/an-uploaded-file-with-radasyncupload-is-missing-after-using-a-radconfirm

 

[quote]Ivan Danchev said:Hello,

Please try the following code snippet. The selected files should not be cleared until the upload button is pressed, when they will be moved to the Target folder ("Uploads") located in the application's root folder:

<telerik:RadWindowManager runat="server" ID="RadWindowManager1"></telerik:RadWindowManager>
<div>
    <script type="text/javascript">
        function confirmCallBackFn(arg) {
            $telerik.$("#Button1").show();
        }
    </script>
 
    <telerik:RadAsyncUpload runat="server" ID="RadAsyncUpload1"
         MultipleFileSelection="Automatic" TargetFolder="~/Uploads" PostbackTriggers="Button1"></telerik:RadAsyncUpload>
 
    <button onclick="radconfirm('Do you want to upload the file?', confirmCallBackFn); return false;">
        show radconfirm</button>
 
    <asp:Button runat="server" ID="Button1" Text="Upload" Style="display: none;"></asp:Button>
</div>


Regards,
Ivan Danchev
Telerik
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 Feedback Portal and vote to affect the priority of the items
[/quote]
0
Ivan Danchev
Telerik team
answered on 27 Jan 2016, 04:47 PM
Hello Gioacchino,

I replied to the forum thread you opened with the same subject. In order to avoid thread duplication I suggest we continue the discussion in it, since it provides more details on your specific scenario than this one.

Regards,
Ivan Danchev
Telerik
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 Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
Kavita
Top achievements
Rank 1
Answers by
Boyan Dimitrov
Telerik team
Gioce90
Top achievements
Rank 1
Ivan Danchev
Telerik team
Share this question
or