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

RadAsyncupload clears on post back

9 Answers 740 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
Dina
Top achievements
Rank 1
Dina asked on 26 May 2016, 10:08 AM

I have few text boxes and one RadAsyncUpload in the form.

When the form is submitted i am validating the text boxes in the server side and showing the validation message. 

when the validation message box is shown, The RadAsyncupload controls is getting cleared.
I want to have the radAsyncUpload Control values to be persisted for the subsequent submit.

 

Thanks

9 Answers, 1 is accepted

Sort by
0
Dina
Top achievements
Rank 1
answered on 30 May 2016, 03:51 AM
Any Update on this
0
Dina
Top achievements
Rank 1
answered on 30 May 2016, 03:51 AM
i have been waiting for this... is there any one can answer this
0
Ivan Danchev
Telerik team
answered on 30 May 2016, 02:23 PM
Hello Ashiq,

You can use the AsyncUpload's PostBackTriggers property to persist the selected file across postbacks. The following documentation article explains this functionality in more detail.

Regards,
Ivan Danchev
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
0
João Pedro
Top achievements
Rank 1
answered on 18 Jan 2017, 10:41 AM

Hi,

I have similiary the same problem.
In my page i have a grid with manual update and delete comands that go to the server and do their proper things.
The problem is, every time i go to the server and back (without using the radAsyncUpload) the RadAsyncUpload gets hidden/cleared.
I have set the PostBackTriggers to a button in my page that deals with the reading of the files. But it doesn't solve.
At this time i am not looking to preserve the files (cause im not even using the RadAsyncUpload). 
I just want to preserve the RadAsyncUpload itself.

Adding another information. After this happend i go to see the source code of the page, and the input of the RadAsyncUpload is type="hidden".

 

Can anyone help me?

0
Ivan Danchev
Telerik team
answered on 23 Jan 2017, 08:30 AM
Hello João Pedro,

How is the AsyncUpload related to the Grid in your scenario? Are you using it in an EditItemTemplate as shown below, or in a different way?
<telerik:GridTemplateColumn DataField="Data" HeaderText="Image" UniqueName="Upload">
    <EditItemTemplate>
        <telerik:RadAsyncUpload RenderMode="Lightweight" runat="server" ID="AsyncUpload1"
            AllowedFileExtensions="jpg,jpeg,png,gif">
        </telerik:RadAsyncUpload>
    </EditItemTemplate>
</telerik:GridTemplateColumn>


Regards,
Ivan Danchev
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
João Pedro
Top achievements
Rank 1
answered on 23 Jan 2017, 09:57 AM

Hi Ivan,

No. My AsyncUpload is outside the grid. It is used as a alternative way to fill the grid.
Below is part of my page' code. Hope it can help.

Thanks is advance,
João Pedro

<telerik:RadAjaxManager ID="RadAjaxManager1" DefaultLoadingPanelID="RadAjaxLoadingPanel1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="grdProcessosLiquidados">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="grdProcessosLiquidados" />
                        <telerik:AjaxUpdatedControl ControlID="RadWindowManager1" />
                        <telerik:AjaxUpdatedControl ControlID="RadInputManager1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <telerik:RadSkinManager ID="RadSkinManager1" runat="server"></telerik:RadSkinManager>
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server" AsyncPostBackTimeout="600">
            <Scripts>
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
            </Scripts>
        </telerik:RadScriptManager>
        <telerik:RadFormDecorator ID="RadFormDecorator1" runat="server" DecoratedControls="All" DecorationZoneID="decorationZone" EnableRoundedCorners="false" />
        <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" LoadingPanelID="RadAjaxLoadingPanel1">
             <telerik:RadScriptBlock runat="server">
                <script type="text/javascript">
                    function KeyPress(sender, args) {
                        var c = args.get_keyCode();
                        if (c == 13) {
                            __doPostBack('btnKeyPress', '');
                        }
                    }
                    function rowDblClick(sender, eventArgs) {
                        sender.get_masterTableView().editItem(eventArgs.get_itemIndexHierarchical());
                    }
                </script>
            </telerik:RadScriptBlock>
            <div class="fieldset-page">
<%-- someFields --%>
                    <telerik:RadGrid ID="grdProcessosLiquidados" runat="server" OnDeleteCommand="grdProcessosLiquidados_DeleteCommand" OnItemCreated="grdProcessosLiquidados_ItemCreated" OnUpdateCommand="grdProcessosLiquidados_UpdateCommand" AllowMultiRowSelection="True" OnItemDataBound="grdProcessosLiquidados_ItemDataBound" AutoGenerateColumns="false" Width="1055px" OnNeedDataSource="grdProcessosLiquidados_NeedDataSource" AllowPaging="true" AllowSorting="true" ShowGroupPanel="false" Skin="Office2010Silver">
                        <ClientSettings AllowKeyboardNavigation="true">
                            <Selecting AllowRowSelect="True" />
                            <Scrolling AllowScroll="True" UseStaticHeaders="false" />
                            <ClientEvents OnRowDblClick="rowDblClick"/>
                        </ClientSettings>
                        <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Wrap="false"/>
                        <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Wrap="false"/>
                        <AlternatingItemStyle HorizontalAlign="Center" VerticalAlign="Middle"/>
                        <EditItemStyle HorizontalAlign="Center" Wrap="false" VerticalAlign="Middle"/>
                        <MasterTableView EditMode="InPlace">
                            <Columns>
                                <telerik:GridEditCommandColumn ButtonType="FontIconButton" />
                                <telerik:GridButtonColumn ConfirmTitle="Delete" ButtonType="FontIconButton" CommandName="Delete" />
                                <telerik:GridBoundColumn DataField="NumeroProcesso" FilterControlAltText="Filter NumeroProcesso column" HeaderText="Nº Processo" SortExpression="NumeroProcesso" UniqueName="NumeroProcesso"    >
                                    <ColumnValidationSettings>
                                        <ModelErrorMessage Text="" />
                                    </ColumnValidationSettings>
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="Nome" FilterControlAltText="Filter Nome column" HeaderText="Nome Cliente" SortExpression="Nome" UniqueName="Nome">
                                    <ColumnValidationSettings>
                                        <ModelErrorMessage Text="" />
                                    </ColumnValidationSettings>
                                </telerik:GridBoundColumn>
                                <%-- someMoreColumns --%>
                            </Columns>
                        </MasterTableView>
                    </telerik:RadGrid>
                    <div class="fieldset-cell" style="width:300px">
                        <telerik:RadLabel ID="lblFicheiro" runat="server" AssociatedControlID="brwFicheiro" Text="Ficheiro:" CssClass="shortLabel"></telerik:RadLabel>
                        <telerik:RadAsyncUpload ID="brwFicheiro" runat="server" MaxFileInputsCount="1" HideFileInput="false" PostbackTriggers="btnImportar">
                        </telerik:RadAsyncUpload>
                    </div>
             </div>
        </telerik:RadAjaxPanel>
        <telerik:RadInputManager ID="RadInputManager1" Skin="Office2010Silver" runat="server" Enabled="true">
            <telerik:NumericTextBoxSetting BehaviorID="NumeroProcessoSetting" Type="Number" DecimalDigits="0" AllowRounding="true"></telerik:NumericTextBoxSetting>
            <telerik:TextBoxSetting BehaviorID="NomeSetting"></telerik:TextBoxSetting>
        </telerik:RadInputManager>
        <telerik:RadWindowManager ID="RadWindowManager1" runat="server"></telerik:RadWindowManager>
       <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server"></telerik:RadAjaxLoadingPanel>
0
Ivan Danchev
Telerik team
answered on 26 Jan 2017, 07:53 AM
Hi João Pedro,

Based on the provided information I think there could be two reasons for the AsyncUpload not being visible after a postback:
  1. A javascript error on the page that prevents the AsyncUpload from being properly initialized and rendered. You can check for such errors in the browser dev tools console.
  2. Updating the same controls with AjaxManager and an AjaxPanel at the same time. This a scenario that must be avoided as mentioned in this article, as it could lead to unexpected/unwanted behavior. In your case the Grid (grdProcessosLiquidados) is added to the AjaxManager's settings, but at the same time it (as well as the AsyncUpload) is wrapped in an AjaxPanel:
<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" LoadingPanelID="RadAjaxLoadingPanel1">

Remove the AjaxPanel and check whether this fixes the issue with the AsyncUpload's visibility.

Regards,
Ivan Danchev
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
João Pedro
Top achievements
Rank 1
answered on 26 Jan 2017, 11:14 AM

Hi Ivan,

The 2nd case was the solution!! Thank you very much for the help ;)

 

Regards,

João Pedro

0
Ivan Danchev
Telerik team
answered on 31 Jan 2017, 09:38 AM
Hello João Pedro,

Updating a control with AjaxManager and AjaxPanel/UpdatePanel at the same is a common mistake. I am glad the issue is fixed.

Regards,
Ivan Danchev
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
AsyncUpload
Asked by
Dina
Top achievements
Rank 1
Answers by
Dina
Top achievements
Rank 1
Ivan Danchev
Telerik team
João Pedro
Top achievements
Rank 1
Share this question
or