我如何在asp.net网页中使用两种语言的文本框 [英] How do i use two language for textbox in asp.net web page

查看:91
本文介绍了我如何在asp.net网页中使用两种语言的文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好

假设有两个TextBox。

TextBox1只接受英语语言

&

TextBox2只接受印地语(印度语)



==

Windows用户可以选择从英语更改键盘输入语言到印地语

但每次语言变化都可能会让用户感到恼火。



所以我只想知道有没有办法解决这个问题?

语言必须在用户输入TextBox时自动更改。



我尝试过:



i TRIED THIS - 语言下拉指数发生变化



//英语

System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(en-us);



// for Hindi

System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(hi-IN);







但它不起作用

Hi there
suppose there are two TextBoxs.
TextBox1 only accept "English" language
&
TextBox2 only accept "Hindi" (Indian Language)

==
Windows user having option to change the keyboard input language from English to Hindi
but every time language changing may be so irritating for user.

So i just want to know is there any way for this?
Language must automatically change as user enter in TextBox.

What I have tried:

i TRIED THIS -- Event fire on Language dropdown index changed

// for english
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-us");

// for Hindi
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("hi-IN");



but it's not working

推荐答案

设置CurrentCulture不会影响基于Web的应用程序中的文本框 - C#代码只在服务器上执行,根本不影响客户端浏览器。

您需要使用Javascript(我从未尝试过更改语言)或使用HTML建议的Richard Deeming。



但没有C#文化变化会影响任何一个文本框。
Setting the CurrentCulture won't affect the textboxes in a web based application - C# code only executes at the server and doesn't influence the client browser at all.
You either need to use Javascript (and I have never even tried changing language with that) or use the HTML as suggested by Richard Deeming.

But no C# Culture change will affect either textbox in the slightest.


Richard的解决方案无法正常工作。甚至,据我所知,选择写作的语言是浏览器,或者基于操作系统。因此,最好使用ASP.NET中的浏览器文件进行一些浏览器设置。



另一种选择是建议用户使用通用语言设置提供的印地语微软。区域和语言设置中提供了此选项。
The solution by Richard was not working. Even, as per my knowledge, language to be choose for writing is browser and alternatively OS based. So, its better to go for some browser settings using browser file in ASP.NET.

Another option is to suggest user to use universal language settings for Hindi language provided by Microsoft. This option was available in Regional and language settings.


这篇关于我如何在asp.net网页中使用两种语言的文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆