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

How to keep file in asyncupload during post back

4 Answers 886 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
Jerry
Top achievements
Rank 1
Jerry asked on 14 Feb 2016, 01:17 AM

Hello,

I have a user registration web form page where users have to enter specific fields. 

I go through and fill out the info but when I leave a required field blank I have a server side error check.  When it does the error check I lose the document within my radAsyncUpload control.    The file is already saved in the App_Data till I save it when the post is error free.

 

Can the control hold the file information till an error free post back is made?

I don't want my users to have to select their file multiple times.

 

Thank you,

Jerry

4 Answers, 1 is accepted

Sort by
0
Ivan Danchev
Telerik team
answered on 17 Feb 2016, 05:15 PM
Hello Jerry,

The RadAsyncUpload has a mechanism for keeping the selected file across postbacks and it involves setting a the PostbackTriggers property. You can learn more about it in the following documentation article.
You could use this functionality along with a HiddenField, the Value of which you can set to "valid" in the code behind and after the postback check the value and upload the file by clicking a hidden button. The selected file will be kept up to that point, because only a postback from Button1 will upload the files:
<script type="text/javascript">
    function pageLoad() {
        var $ = $telerik.$;
        if ($("#HiddenField1").val() == "valid") {
            $("#HiddenField1").val("");
            $("#Button1").click();
        }
    }
</script>
<asp:HiddenField runat="server" ID="HiddenField1" />
<telerik:RadAsyncUpload runat="server" ID="RadAsyncUpload1" TargetFolder="~/Uploads" PostbackTriggers="Button1">
</telerik:RadAsyncUpload>
 
<asp:Button Text="Upload" ID="Button2" runat="server" OnClick="Button2_Click" />
<asp:Button runat="server" ID="Button1" Style="display: none;"></asp:Button>


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
Dani
Top achievements
Rank 1
answered on 19 May 2017, 07:46 AM

Hi,

I have a problem with this RadAsnycUpload control wich is used multiple times on the first page of a Wizard that is implemented with MVP pattern and has a custom validation. 

The settings for the multiple RadAsnycUpload  controls are :

  <uc1:UploadFilesControl ID="oUploadMatrix" runat="server" Path="\LoggerInfos\Matrix\"
                Info="Hinweis: Mindestens eine *.dbc / *.ldf / *.xml-Datei ist erforderlich"
                Style="margin-bottom: 15px" PostbackTriggers="btnOk" OnClientValidationFailed="OnMatrixFileValidationFailed" />

Now the problem : 

Each time a validation error occurs and user corrects it the RadAsnycUpload loses the uploaded file.

Can you help me please with this problem ? 

 

 

0
Jagat
Top achievements
Rank 1
answered on 12 Aug 2019, 03:14 PM

I have a similar issue where the file is getting lost when a validation fails.

How did you fix this issue?

 

Thanks

0
Rumen
Telerik team
answered on 13 Aug 2019, 08:24 AM
Hi there,

There is another forum thread on this scenario. Please check it out at Retain uploaded files for display after postback / validation problems.

Regards,
Rumen
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
AsyncUpload
Asked by
Jerry
Top achievements
Rank 1
Answers by
Ivan Danchev
Telerik team
Dani
Top achievements
Rank 1
Jagat
Top achievements
Rank 1
Rumen
Telerik team
Share this question
or