【问题标题】:How set the culture for fileupload (input file) control in ASP.NET如何在 ASP.NET 中为文件上传(输入文件)控件设置区域性
【发布时间】:2012-10-19 08:18:07
【问题描述】:

在我的网站上更改文化(语言)时遇到问题。事实上,所有的控件都正确地改变了语言。但只有控件“asp:FileUpload”不改。文字描述总是一样的...... 是否可以在“”或“”之类的按钮上强制使用语言?

提前谢谢你。

【问题讨论】:

    标签: asp.net programming-languages globalization culture currentculture


    【解决方案1】:

    您可以通过选择其 ID 的 CSS 样式隐藏按钮。

    <style type="text/css">
        input.fileUpload{
            display: block;
            visibility: hidden;
            width: 0;
            height: 0;
        }
    </style>
    

    然后创建一个按钮来触发文件上传。

    <script type="text/javascript">
    $("#alternateUploadButton").click(function(){
        $("#fileUpload").click();
    });
    </script>
    <input type="file" id="fileUpload" name="fileUpload">
    <button id="alternateUploadButton">
        Get a file or whatever name you want
    </button>
    

    http://jsfiddle.net/SPVkq/

    【讨论】:

      【解决方案2】:

      不幸的是,文件上传按钮上的“浏览...”标签是由浏览器提供的,而不是由您的标记提供的,因此您无法控制。有一些技巧,但您可能需要考虑是否值得麻烦,因为此“浏览...”按钮应使用用户可以理解的语言,因为它与浏览器的语言相匹配。

      查看其他帖子了解更多信息: ASP.NET FileUpload - How to change the language of the "Browse..." button description?

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2011-03-27
        • 2018-01-04
        • 2015-12-08
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-08-16
        相关资源
        最近更新 更多