Thursday, 8 May 2014

How to Create Text Box Hindi Transliteration in ASP.Net & C#

By Unknown   Posted at  07:16   No comments

Use Hindi Hindi Transliteration In asp.Net Textbox To Language converter


In Asp.net & C# TextBox insert Hindi Transliteration.Here I am mainly targeting english to hindi transliteration. You can use any language which is supported by Google Transliteration.

To create a Hindi Textbox in  ASP.Net using Google Transliteration, you have to add the following script source into your ASPX page.




<script src="https://www.google.com/jsapi"
type="text/javascript">

</script>


After adding above script source file, Now write the following java script. 

<script language="javascript" type="text/javascript">
google.load("elements", "1", {packages: "transliteration"});
      
function onLoad() {
 var options = {
    //Source Language
    sourceLanguage: google.elements.transliteration.LanguageCode.ENGLISH,
    // Destination language to Transliterate
    destinationLanguage: [google.elements.transliteration.LanguageCode.HINDI],
    shortcutKey: 'ctrl+g',
    transliterationEnabled: true
 };
      
    var control = new google.elements.transliteration.TransliterationControl(options);
    control.makeTransliteratable(['YourTextBoxClientID']);
     
}
google.setOnLoadCallback(onLoad);

</script>


This  is the full ASPX page code in Aspx Page.


<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="MultiPagetoPdf.WebForm1" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Hindi Textbox Demo</title>
   <script src="https://www.google.com/jsapi" type="text/javascript">
    </script>
    <script language="javascript" type="text/javascript">
        google.load("elements", "1", { packages: "transliteration" });

        function onLoad() {
            var options = {
                //Source Language
                sourceLanguage: google.elements.transliteration.LanguageCode.ENGLISH,
                // Destination language to Transliterate
                destinationLanguage: [google.elements.transliteration.LanguageCode.HINDI],
                shortcutKey: 'ctrl+g',
                transliterationEnabled: true
            };

            var control = new google.elements.transliteration.TransliterationControl(options);
            control.makeTransliteratable(['TextBox1']);

        }
        google.setOnLoadCallback(onLoad);
</script>
</head>
<body>
    <form id="form1" runat="server">
   <div>
    <asp:textbox id="TextBox1" runat="server" style="border: 1px solid black; height: 125px; margin-left: auto; width: 550px;" textmode="MultiLine">
</div> 
</form> 
</body> 

</html>


Thanks

0 comments:

Back to top ↑
Connect with Us

What they says

© 2013 A2zcomponents. WP All Components Converted by BloggerTheme9
A2zcomponents.blogspot.in. | Distributed by All Components Proudly Powered by A2zcomponents.blogspot.in.