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

The remove button does not get localized after a postback

4 Answers 20 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
Wesley
Top achievements
Rank 1
Wesley asked on 20 May 2014, 05:46 PM
When uploading a file using AsyncUpload, the delete button correctly uses the string I set up for localization. However, after a postback, the same button does not get translated.
The code I'm using resembles this one below.

I found out that the method _marshalUploadedFiles ‚Äčinside RadAsyncUploadScripts.js uses a hard-coded string in English to generate the button. It does not want to use the localization.

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager runat="server" />
        <telerik:RadAsyncUpload Localization-Remove="Supprimer" runat="server" ID="upload" PostbackTriggers="btn2"></telerik:RadAsyncUpload>
        <asp:Button runat="server" Text="Intermediate postback" ID="btn1" />
        <asp:Button runat="server" Text="Final postback" ID="btn2" />
    </form>
</body>
</html>

4 Answers, 1 is accepted

Sort by
0
Accepted
Nencho
Telerik team
answered on 23 May 2014, 01:16 PM
Hello Wesley,

Your observations are absolutely correct. I would suggest you to overwrite the mentioned method in the following manner, in order to persist the correct localization string:
<script type="text/javascript">
        var $ =$telerik.$;
        Telerik.Web.UI.RadAsyncUpload.prototype._marshalUploadedFiles = function (clientStateString) {
            var removeText = this.get_localization().Remove;
            var clientState = Sys.Serialization.JavaScriptSerializer.deserialize(clientStateString),
                uploadedFiles = clientState.uploadedFiles;
 
            this._uploadedFiles = uploadedFiles;
            this._selectedFilesCount = uploadedFiles.length;
 
            for (var i = 0; i < uploadedFiles.length; i++) {
                var $uploadedFileWrapper = $("<li><span class=\"ruFileWrap ruStyled\"><span class=\"ruUploadProgress ruUploadSuccess\">"
                + uploadedFiles[i].fileInfo.FileName
                + "</span></span><input class=\"ruButton ruRemove\" type=\"button\" tabindex=\"-1\" value=\"" + removeText + "\" name=\"RowRemove\"></li>");
 
                $uploadedFileWrapper.data('fileInfo', uploadedFiles[i]);
                $(".ruInputs", this.get_element()).append($uploadedFileWrapper);
            }
        }
    </script>

I have forwarded the issue to our developer team for fixing this problem.

Thank you for pointing that out.

Regards,
Nencho
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
Wesley
Top achievements
Rank 1
answered on 23 May 2014, 01:58 PM
Thank you, Nencho.
0
Etienne
Top achievements
Rank 1
answered on 29 Jul 2014, 09:32 PM
Was there any development on this because I have the same issue. My client is french and all our labels need to be in french so on the post bast I need the labels to be french.

Thanks
0
Nencho
Telerik team
answered on 01 Aug 2014, 10:56 AM
Hello Etienne,

There should be no issue with the other labels, except for the one, which workaround was provided above. Could you specify if you are observing any different problematic behavior?

Regards,
Nencho
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.

 
Tags
AsyncUpload
Asked by
Wesley
Top achievements
Rank 1
Answers by
Nencho
Telerik team
Wesley
Top achievements
Rank 1
Etienne
Top achievements
Rank 1
Share this question
or