Click here to Skip to main content
15,881,803 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi,
Can i specify culture of text boxes also.I have two text boxes in one page.I want user should be able to enter english only in one text box and hindi in other(default language).is this possible.
Posted
Updated 1-May-12 22:59pm
v2

Generally you can enter text of any language and alphabet into any text boxes - that's the big advantage of unicode. In your case, you could apply some filtering for the ranges of the characters entered into the text boxes, i.e. subscribe to the TextChanged event and check if all the characters are "English" or "Hindi".

[Edit]
Now I understand what you want to achieve.
System.Windows.Forms.InputLanguage is what you need. In the Enter event, set the CurrentInputLanguage (do not forget to verify that Hindi is available!).
See http://social.msdn.microsoft.com/Forums/ar/csharpgeneral/thread/0e551a77-4251-475a-aec4-5ef576b4761a[^]
But I doubt that something like that can be used on a web page...
[/Edit]
 
Share this answer
 
v2
Comments
ashishdhingra 2-May-12 4:07am    
currently that is being achieved.but users has to change language from language bar.i want user shouldn't do that.In text box,if it is English,when we will press any key English should be typed,if it is Hindi,hindi should be typed automatically.means users should not change from language bar.with the hindi font we can do,but my requirement is of unicode.
Hi,

Google provides a good script to do this,
try this :

add these script in your HEAD section

JavaScript
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
   <script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>
   <script type="text/javascript">
       google.load("elements", "1", {
           packages: "transliteration"
       });

       function eng() {
           var options = {
               sourceLanguage: google.elements.transliteration.LanguageCode.ENGLISH,
               destinationLanguage: [google.elements.transliteration.LanguageCode.HINDI],
               transliterationEnabled: true
           };
           var control =
     new google.elements.transliteration.TransliterationControl(options);
           control.makeTransliteratable(['textHindi']);
       }
       function hindi() {
           var options = {
               sourceLanguage: google.elements.transliteration.LanguageCode.HINDI,
               destinationLanguage: [google.elements.transliteration.LanguageCode.ENGLISH],
               transliterationEnabled: true
           };
           var control =
     new google.elements.transliteration.TransliterationControl(options);
           control.makeTransliteratable(['textHindi']);
       }

       $(document).ready(function () {
           $('#textHindi').focus(function () {
               eng();
           });
           $('#textEng').focus(function () {
               hindi();
           });
       });

       google.setOnLoadCallback(eng);
       google.setOnLoadCallback(hindi);
   </script>


and add two textboxes like:

HTML
<table>
       <tr>
           <td align="left">
               <input type="text" id="textHindi" />
           </td>
           <td>
               <input type="text" id="textEng" />
           </td>
       </tr>
   </table>


now test your code by writing some text in both textboxes,

hope this help you.
 
Share this answer
 
Comments
ashishdhingra 2-May-12 5:03am    
But this script works only for online mode...My application works on intranet not on internet.
tanweer 2-May-12 5:14am    
ok then download and add this file in your own application and try
http://www.google.com/jsapi
ashishdhingra 7-May-12 1:48am    
this java script refers to google.com internally...so it cant be used for offline mode.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900