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


    $(document).ready(function () {
        google.load("elements", "1", {
            packages: "transliteration"
        });

        function onLoad() {
            var options = {
                sourceLanguage:
    google.elements.transliteration.LanguageCode.ENGLISH,
                destinationLanguage:
    google.elements.transliteration.LanguageCode.HINDI,

                shortcutKey: 'ctrl+g',
                transliterationEnabled: true
            };
            var control =
new google.elements.transliteration.TransliterationControl(options);
            control.makeTransliteratable(['<%=TextBox1.ClientID%>']);
        }

        // here you make the first init when page load
        google.setOnLoadCallback(onLoad);

        // here we make the handlers for after the UpdatePanel update
        var prm = Sys.WebForms.PageRequestManager.getInstance();
        prm.add_initializeRequest(InitializeRequest);
        prm.add_endRequest(EndRequest);

        function InitializeRequest(sender, args) {
        }

        // this is called to re-init the google after update panel updates.
        function EndRequest(sender, args) {
            onLoad();
        }
    });

</script>

    // update panel with button to make post back
                <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <ContentTemplate>
                    <asp:TextBox ID="TextBox1" runat="server" />
                    <asp:Label ID="Label1" Text="text" runat="server" />
                    <asp:Button ID="Button1" Text="Postback" runat="server" OnClick="Button1_Click" />
                </ContentTemplate>
            </asp:UpdatePanel>

私はすでにこの解決策を試しました ajax更新パネルのテキストボックスに使用されるGoogleトランスレーターjavaスクリプトが機能しません 。ページの外側からGoogleの文字変換コードを配置すると、正常に機能しますが、ポストバック後は機能しません。ページ準備完了イベント内にコードを配置すると、ページが読み込まれません。私を助けてください。

4

1 に答える 1