測試文字功能,小工具,標題

記錄很重要,不然會浪費很多時間在找以前的記憶

一個人的氣度,決定他未來的高度。

2016年8月3日 星期三

Ajax Control Toolkit AjaxFileUpload SelectFile 按鈕中文化

AjaxFileUpload SelectFile 按鈕中文化

想不到要把AjaxFileUpload按鈕中文化竟然要透過jquery


網路上只找到這個範例能改成中文,有找到其他的再補上

Ajax Control Toolkit 是 v16版本
VS2012
好像只能在IIS8上運作,在II7一直有問題,另一個是AsyncFileUpload ,好像只能單選,還找不方法可以解決
http://ajaxcontroltoolkit.devexpress.com/AsyncFileUpload/AsyncFileUpload.aspx

原本是這樣


改完變這樣


html的code

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <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>
 <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
 <script type="text/javascript">

     //run AjaxFileUpload_change_text() function after page load
     //that example uses  jquery
     $(document).ready(function () {
         AjaxFileUpload_change_text();

     });



     function AjaxFileUpload_change_text() {
         //Here you can write whatever you want = "..."
         Sys.Extended.UI.Resources.AjaxFileUpload_SelectFile = "選擇檔案";
         Sys.Extended.UI.Resources.AjaxFileUpload_DropFiles = "Drop files here";
         Sys.Extended.UI.Resources.AjaxFileUpload_Pending = "pending";
         Sys.Extended.UI.Resources.AjaxFileUpload_Remove = "Remove";
         Sys.Extended.UI.Resources.AjaxFileUpload_Upload = "Upload";
         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";
     }

</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
    <ajaxToolkit:AjaxFileUpload ID="AjaxFileUpload1" runat="server" />
</asp:Content>

====下面是web.config設定,藍色字是後來加上去的==============================


<configuration>

    <system.web>
      <compilation debug="true" targetFramework="4.5" />
      <httpRuntime targetFramework="4.5" />
      <httpHandlers>
        <add verb="*" path="AjaxFileUploadHandler.axd" type="AjaxControlToolkit.AjaxFileUploadHandler, AjaxControlToolkit"/>
      </httpHandlers>
      <pages>
      <controls>
        <add tagPrefix="ajaxToolkit" assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" />
      </controls>
    </pages></system.web>
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false"/>
    <handlers>
      <add name="AjaxFileUploadHandler" verb="*" path="AjaxFileUploadHandler.axd" type="AjaxControlToolkit.AjaxFileUploadHandler, AjaxControlToolkit"/>
    </handlers>
    <security>
      <requestFiltering>
        <requestLimits maxAllowedContentLength="4294967295"/>
      </requestFiltering>
    </security>
  </system.webServer>

</configuration>

沒有留言:

張貼留言