更改AjaxFileUpload控件的语言

时间:2014-07-10 23:36:20

标签: asp.net

我想在我的c#网站中使用AjaxFileUpload控件。我希望我的控制能够使用我的当地语言。我试过下面的代码。在我的代码中,一些单词并不丰富多彩(例如:Sys.Extended.UI.Resources.AjaxFileUpload_SelectFile =“DosyaSeç”;)它就像未定义。我怎样才能改变我的控制语言?

<style type="text/css">

/* Buttons widths */
.ajax__fileupload_fileItemInfo div.removeButton{width:100px;}
div.ajax__fileupload_uploadbutton{width:120px;}
.ajax__fileupload .ajax__fileupload_selectFileContainer{width: 110px;}
.ajax__fileupload_selectFileContainer .ajax__fileupload_selectFileButton{width: 110px;}
</style>

 $(document).ready(function () {
     AjaxFileUpload_change_text();

 });



 function AjaxFileUpload_change_text() {

     Sys.Extended.UI.Resources.AjaxFileUpload_SelectFile = "Dosya Seç";
     Sys.Extended.UI.Resources.AjaxFileUpload_DropFiles = "Sürükle-Bırak";
     Sys.Extended.UI.Resources.AjaxFileUpload_Pending = "Bekliyor";
     Sys.Extended.UI.Resources.AjaxFileUpload_Remove = "Kaldır";
     Sys.Extended.UI.Resources.AjaxFileUpload_Upload = "Yükle";
     Sys.Extended.UI.Resources.AjaxFileUpload_Uploaded = "Uploaded";
     Sys.Extended.UI.Resources.AjaxFileUpload_UploadedPercentage = "uploaded {0} %";
     Sys.Extended.UI.Resources.AjaxFileUpload_Uploading = "Uploading";
     Sys.Extended.UI.Resources.AjaxFileUpload_FileInQueue = "{0} file(s) in queue.";
     Sys.Extended.UI.Resources.AjaxFileUpload_AllFilesUploaded = "All Files Uploaded.";
     Sys.Extended.UI.Resources.AjaxFileUpload_FileList = "List of Uploaded files:";
     Sys.Extended.UI.Resources.AjaxFileUpload_SelectFileToUpload = "Please select file(s) to upload.";
     Sys.Extended.UI.Resources.AjaxFileUpload_Cancelling = "Cancelling...";
     Sys.Extended.UI.Resources.AjaxFileUpload_UploadError = "An Error occured during file upload.";
     Sys.Extended.UI.Resources.AjaxFileUpload_CancellingUpload = "Cancelling upload...";
     Sys.Extended.UI.Resources.AjaxFileUpload_UploadingInputFile = "Uploading file: {0}.";
     Sys.Extended.UI.Resources.AjaxFileUpload_Cancel = "Cancel";
     Sys.Extended.UI.Resources.AjaxFileUpload_Canceled = "cancelled";
     Sys.Extended.UI.Resources.AjaxFileUpload_UploadCanceled = "File upload cancelled";
     Sys.Extended.UI.Resources.AjaxFileUpload_DefaultError = "File upload error";
     Sys.Extended.UI.Resources.AjaxFileUpload_UploadingHtml5File = "Uploading file: {0} of size {1} bytes.";
     Sys.Extended.UI.Resources.AjaxFileUpload_error = "error";
 }

1 个答案:

答案 0 :(得分:4)

您可以使用JavaScript或jQuery来更改该文本:

只需将此代码添加到您正在使用文件上传控件的页面顶部。

 <script>
    function pageLoad(sender, args) {

       //By jQuery
       $(".ajax__fileupload_selectFileButton").text("Dosya Seç");

       //By JavaScript
       document.getElementsByClassName('ajax__fileupload_selectFileButton')[0].innerHTML = "Dosya Seç";
   }
</script>

并使用相同的技术更改其他文本。