如何在ASP.NET中为fileupload(输入文件)控件设置文化

时间:2012-10-19 08:18:07

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

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

等按钮上强制使用该语言

先谢谢你。

2 个答案:

答案 0 :(得分:1)

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

<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/

答案 1 :(得分:0)

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

有关详细信息,请参阅此其他帖子: ASP.NET FileUpload - How to change the language of the "Browse..." button description?