You must Sign In to post a response.
  • Category: ASP.NET

    How set keyboard language in textbox into asp.net

    Hi,

    I our client want to write some comment in hindi / english. if he selected in hindi them it is
    starting type in hind or if he selecte english then starting typing in english. In our application
    when form load it is starting english because default is english, But if he select hindi then it is
    starting hindi also. But problem is that when i select english then it not support to english typing


    Javascript code :

    <script type="text/javascript">
    // Load the Google Transliterate API
    google.load("elements", "1", {
    packages: "transliteration"
    });

    function CallonLoad() {
    // Create an instance on TransliterationControl with the required
    // options.
    var varComment = $("input[name='<%=rblLanguage.UniqueID%>']:checked").val();

    if (varComment == 0) {
    var optionsEng = {
    sourceLanguage:
    google.elements.transliteration.LanguageCode.ENGLISH,
    destinationLanguage:
    [google.elements.transliteration.LanguageCode.ENGLISH],
    shortcutKey: 'ctrl+g',
    transliterationEnabled: true
    };

    var control = new google.elements.transliteration.TransliterationControl(optionsEng);
    }
    else if (varComment == 1) {
    var optionsMar = {
    sourceLanguage:
    google.elements.transliteration.LanguageCode.ENGLISH,
    destinationLanguage:
    [google.elements.transliteration.LanguageCode.MARATHI],
    shortcutKey: 'ctrl+g',
    transliterationEnabled: true
    };

    var control = new google.elements.transliteration.TransliterationControl(optionsMar);
    }
    // Enable transliteration in the textbox with id
    // 'transliterateTextarea'.
    control.makeTransliteratable(['<%=tbComment.ClientID%>']);
    }
    google.setOnLoadCallback(CallonLoad);
    </script>


    aspx form
    =========
    <div id="Div1" class="row" runat="server">
    <div class="col-sm-7 form-group">
    <b>Language</b>
    <asp:RadioButtonList ID="rblLanguage" runat="server" RepeatDirection="Horizontal"
    CellPadding="20" onclick="CallonLoad()">
    <asp:ListItem Value="0" Selected="True">English   </asp:ListItem>
    <asp:ListItem Value="1">?????</asp:ListItem>
    </asp:RadioButtonList>
    </div>
    </div>
    <div class="row" runat="server">
    <div class="col-sm-7 form-group">
    <b>Comments</b>
    <asp:TextBox ID="tbComment" TextMode="MultiLine" Width="500px" Rows="5" runat="server"
    placeholder="Enter Comments.." class="form-control"></asp:TextBox>
    </div>
    </div>
  • #767310
    Hi,
    Its because in varComment == 0 you have assigned sourceLanguage to english that means it will translate to english only when you have enterd any english word inside textbox.

    For varComment == 0
    Source i.e. textbox value--> English
    Conversion from English -->English

    Then For varComment == 1
    Source i.e. textbox value--> English
    Conversion from English -->Marathi

    When you select English again:
    i.e. Again for varComment == 0
    Source i.e. textbox value--> Marathi
    Conversion from English -->English
    So this is wrong here.


Sign In to post your comments