2012-12-07 58 views
0

我有一個JavaScript中的問題在asp.net無法加載時的UpdatePanel回發到服務器,問題是,JavaScript代碼是不是在同一個頁面,在UpdatePanel是如此我可以把它放在頁面加載()函數,它是這樣的:的JavaScript不加載在ASP.Net

<script src="js/keyboard.js" type="text/javascript"></script> 

和我使用ASP.Net 4和C#這是我的代碼代碼:

<link href="css/keyboard.css" rel="stylesheet" /> 
<asp:UpdatePanel ID="UpdatePanel1" runat="server"> 
    <ContentTemplate> 
     <div style="text-align: left; padding-right: 140px"> 
      <dx:aspxcombobox id="comboBoxLangauge" clientinstancename="comboboxLang" 
       cssclass="combo" runat="server" width="140px" clientidmode="Static"> 
       <Items> 
        <dx:ListEditItem Text="English to Kurdish" Value="1" Selected="true" /> 
        <dx:ListEditItem Text="Kurdish to English" Value="2" /> 
       </Items> 
       <ClientSideEvents SelectedIndexChanged="IndexChanged" />    
      </dx:aspxcombobox> 
     </div> 
     <br /> 
     <br /> 
     <asp:Button ID="btnTranslate" runat="server" Text="Search" ClientIDMode="Static" 
      CssClass="Search" OnClick="btnTranslate_Click" /> 
     <asp:TextBox ID="txtBoxWord" runat="server" ClientIDMode="Static" 
      class="keyboardInput Search" Style="width: 260px; direction: ltr"></asp:TextBox> 

     <asp:AutoCompleteExtender ID="autocom" ClientIDMode="Static" runat="server" CompletionSetCount="10" 
      EnableCaching="true" MinimumPrefixLength="1" TargetControlID="txtBoxWord" ServicePath="~/translator/AutoComplete.asmx" ServiceMethod="GetCompletionList"> 
     </asp:AutoCompleteExtender> 

     <asp:RoundedCornersExtender ID="RoundedCornersExtender1" runat="server" TargetControlID="OutPanel" 
      Corners="All" Radius="5" BorderColor="Silver"> 
     </asp:RoundedCornersExtender> 
     <br /> 
     <br /> 
     <div id="OutPanel" runat="server" clientidmode="Static" style="width: 440px; height: 200px; overflow: auto; margin-left: auto; margin-right: auto; padding-top: 10px;" visible="false"> 
     </div> 
    </ContentTemplate> 
</asp:UpdatePanel> 
<div id="OutPanel" runat="server" clientidmode="Static" style="width:440px;height:200px;overflow:auto;margin-left:auto;margin-right:auto;padding-top:10px;" visible="false"> 

</div> 
     </ContentTemplate> 
    </asp:UpdatePanel> 

回答

0

「問題是JavaScript代碼是不相同的頁面,在UpdatePanel爲」

而確保您的的JavaScript可與UpdatePanel在頁面上正確加載它。

相關問題