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> 

이미이 솔루션을 사용해 보았습니다. Does not work Google translator java Script used to text box in ajax update panel . 페이지 외부에서 Google 음역 코드를 준비하면 제대로 작동하지만 다시 게시하면 작동하지 않습니다. 페이지 준비 이벤트 내에 코드를 삽입하면 페이지가로드되지 않습니다. 도와주세요.Google 음역이 업데이트 패널에서 작동하지 않습니다.

+0

나에게 어떤 시체를 도와주세요 추가합니다. 그것은 급해 –

답변

0

당신이 사용

<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> 
<Triggers> 
     <asp:PostBackTrigger ControlID="Button1" /> 
</Triggers> 
     </asp:UpdatePanel>