Search code examples
c#asp.netinputtextboxurdu

Automatically change input language


i am trying to build an web application in which i want to take inputs in two language english and urdu.

<asp:TextBox ID="txturdu" runat="server"></asp:TextBox>
<asp:TextBox ID="txtenglish" runat="server"></asp:TextBox>

So what i am trying to do is when i click on textbox (txturdu) it automatically takes input in urdu language.


Solution

  • 1 - Listen to key press event
    2 - Detect pressed key code example
    3 - Translate the pressed key code to the Urdu character (may be you can use Array[code,character] here)
    4 - Add the character to yourtextbox.Text don't forget to call event.preventDefault();
    to prevent adding the character in the default language again