How to keep file in asyncupload during post back

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

    Posted 13 Feb 2016 Link to this post


    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,


  2. Ivan Danchev
    Ivan Danchev avatar
    1039 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") {
    <asp:HiddenField runat="server" ID="HiddenField1" />
    <telerik:RadAsyncUpload runat="server" ID="RadAsyncUpload1" TargetFolder="~/Uploads" PostbackTriggers="Button1">
    <asp:Button Text="Upload" ID="Button2" runat="server" OnClick="Button2_Click" />
    <asp:Button runat="server" ID="Button1" Style="display: none;"></asp:Button>

    Ivan Danchev
    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
Back to Top