How to keep file in asyncupload during post back

3 posts, 0 answers
  1. Jerry
    Jerry avatar
    45 posts
    Member since:
    Mar 2012

    Posted 13 Feb 2016 Link to this post

    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

  2. Ivan Danchev
    Admin
    Ivan Danchev avatar
    1263 posts

    Posted 17 Feb 2016 Link to this post

    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
  3. Dani
    Dani avatar
    1 posts
    Member since:
    May 2017

    Posted 19 May Link to this post

    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 ? 

     

     

Back to Top