开发者

ASP.NET FileUpload - How to change the language of the "Browse..." button description?

开发者 https://www.devze.com 2023-01-03 18:20 出处:网络
I know the very similar question was posted here already (How to change the Text of the browse button in the FileUpload Control (System.Web.UI.WebControls)) and I understand it\'s not possible to chan

I know the very similar question was posted here already (How to change the Text of the browse button in the FileUpload Control (System.Web.UI.WebControls)) and I understand it's not possible to change the description t开发者_JS百科o some custom text, but isn't it at least possible to change it to a different language (e.g. to English)?

I'd like to do it so that my web page is whole in one language (because e.g. "Procházet..." instead of "Browse..." in the middle of English web page looks kind of weird to me).


This is determined at the browser level, unless you moved to something like a flash-based uploader (or <iframe> trickery), you can't customize it. Whatever language/localization the user's browser is in (usually based on the OS setting), that's the language they'll get on the "Browse..." button.

If your page is for consumers likely already in that language, then you're all set, the default behavior works. If people with another language setting come by, well...that's the language they picked, so it should be an intuitive button label, even if it doesn't match.


Although there is direct way to change the Caption of InputFile control,but you can always go for alternative way,

  • Add InputFile control to you page let's say "fileUpload" and make it Hidden or invisible.
  • Add new HTMLButton on form with Text Whatever you wanted to give it to your fileupload button (in addition you can also add TextBox too to show uploaded file name when events being gets handle at server side).
  • Onclick even of above button use below javascript
document.getElementById("fileUpload").click();

It will do the same thing without showing up default InputFile control.


No, it's a matter of client's operating system.

0

精彩评论

暂无评论...
验证码 换一张
取 消