2012-05-04 6 views
0

私はaspxページに2つのアップデートパネルを持っています。私はJavaScriptコードを使用して進捗状況を示したい。しかし、特定の更新パネルのトリガーボタンをクリックすると、両方の更新パネルが更新されています。ボタンをクリックするとただ1つだけ更新されます。複数のASPに関する問題:アップデートパネル(両方とも更新されます)

<script type="text/javascript"> 
       var prm = Sys.WebForms.PageRequestManager.getInstance(); 
       prm.add_initializeRequest(prm_InitializeRequest); 
       prm.add_endRequest(prm_EndRequest); 
       function prm_InitializeRequest(sender, args) { 
        $('#loading').show("slow"); 
        /*var panelProg = $get('loading'); 
        panelProg.style.display = '';*/ 
        $get(args._postBackElement.id).disabled = true; 
       } 
       function prm_EndRequest(sender, args) { 
        $('#loading').hide("slow"); 

        /*var panelProg = $get('loading'); 

        panelProg.style.display = 'none';*/ 
        $get(sender._postBackSettings.sourceElement.id).disabled = false; 
       } 

上記は、私のjavascriptコードです。

<asp:UpdatePanel ID="updateQuestions" runat="server"> 
       <ContentTemplate> 
        <div class="descHeader" style="width: 600px;"> 
         <asp:Label ID="Label2" runat="server" Text="Last 10 Questions"></asp:Label> 
        </div> 
        <div class="descContent" style="width: 600px; height: auto;"> 
         <div id="loading" style="display: none; height: 60px;"> 
          <asp:Image ID="img1" runat="server" ImageUrl="~/images/site/process.gif" /> 
         </div> 
         <asp:Panel ID="pnlQuestions" runat="server"> 
         </asp:Panel> 
        </div> 
       </ContentTemplate> 
       <Triggers> 
        <asp:AsyncPostBackTrigger ControlID="btnAsk" EventName="Click" /> 
       </Triggers> 
      </asp:UpdatePanel> 

上記は、更新したい更新パネルです。 もう1つの更新パネルはマストページにあり、ここにあります。

<asp:UpdatePanel ID="uPCheckin" runat="server" UpdateMode="Always"> 
      <ContentTemplate> 
       <asp:Panel ID="pnlCheckIn" runat="server" CssClass="pnlCheckIn"> 
        <asp:Label ID="Label1" runat="server" Text="Where are you now ?" Font-Size="10px" 
         ForeColor="Black"></asp:Label> 
        <br /> 
        <asp:TextBox ID="txtCheckIn" runat="server" ForeColor="Gray"> 
        </asp:TextBox> 
        <asp:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender1" runat="server" WatermarkText="Type City Name" 
         Enabled="True" TargetControlID="txtCheckIn"> 
        </asp:TextBoxWatermarkExtender> 
        <asp:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server" CompletionSetCount="4" 
         CompletionInterval="4" EnableCaching="true" Enabled="True" MinimumPrefixLength="3" 
         ServiceMethod="NewDestinationComplete" ServicePath="~/DestinationComplete.asmx" 
         TargetControlID="txtCheckIn" CompletionListCssClass="autocomplete_completionListElement" 
         CompletionListItemCssClass="autocomplete_listItem" CompletionListHighlightedItemCssClass="autocomplete_highlightedListItem"> 
        </asp:AutoCompleteExtender> 
        <asp:Button ID="btnCheckIn" runat="server" Text="Check-In" CssClass="btnSaveChanges" 
         OnClick="btnCheckIn_Click" /> 
        <br /> 
       </asp:Panel> 
      </ContentTemplate> 
     </asp:UpdatePanel> 

ありがとうございました。

答えて

0

実際に私が見ることができるのは、更新パネルでUpdateModeが「条件付き」に設定されていることです。 これにより、そのパネルのみが更新されます。

関連する問題