The remove button does not get localized after a postback

5 posts, 1 answers
  1. Wesley
    Wesley avatar
    2 posts
    Member since:
    Nov 2012

    Posted 20 May 2014 Link to this post

    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>
  2. Answer
    Nencho
    Admin
    Nencho avatar
    1458 posts

    Posted 23 May 2014 Link to this post

    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.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Wesley
    Wesley avatar
    2 posts
    Member since:
    Nov 2012

    Posted 23 May 2014 in reply to Nencho Link to this post

    Thank you, Nencho.
  5. Etienne
    Etienne avatar
    1 posts
    Member since:
    Jul 2011

    Posted 29 Jul 2014 Link to this post

    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
  6. Nencho
    Admin
    Nencho avatar
    1458 posts

    Posted 01 Aug 2014 Link to this post

    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.

     
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017