2011-01-07 61 views
1

我在每個直放站行中顯示總結和詳細信息客戶信息 - 在中繼器內部。在直放站中顯示隱藏Div的項目模板

總結的東西是它自己的div:(ID =「divHistory_Summary)的細節的東西,在它自己的DIV:(ID =」 divHistory_details」)

細節DIV默認情況下與內嵌樣式隱藏:顯示器:無;

<asp:Repeater ID="RepeaterCustHistory" runat="server"> 
       <ItemTemplate> 

       <div id="divHistory_Summary" class="cust_summary" style="width: 100%; cursor: pointer" > 
        <div id="divTicketNumber" style="display: inline; float: left;"> 
          <u><strong>Ticket ID:</strong> <asp:Label ID="lblCustHelpDeskTicketId" runat="server" Text='<%# Eval("HelpDesk_id") %>' /></u> 
        </div> 

         <div id="divProblem" style="display: inline; float: left; padding-left: 10px;"> 
         <strong>Problem:</strong> <asp:Label ID="lblProblem" runat="server" Text='<%# Eval("HelpDesk_problem") %>' /> 
        </div> 

        <div id="divStatus" style="display: inline; float: left; padding-left: 10px;"> 
         <strong>Status:</strong> <asp:Label ID="Label1" runat="server" Text='<%# Eval("HelpDesk_name") %>' /> 
        </div> 

        </div> 

        <div id="divHistory_details" class="cust_details" style=" width: 100%; float: left; display: none; "> 
         <strong>Solution:</strong> <asp:Label ID="lblSolution" runat="server" Text='<%#Eval("HelpDesk_solution") %>' ></asp:Label> 
       </div> 

      </ItemTemplate> 
      <SeparatorTemplate> 
      <hr /> 
      </SeparatorTemplate> 
    <FooterTemplate> 
    </FooterTemplate> 

    </asp:Repeater> 

在我的aspx頁面的底部,我有我的jquery:

<script src='<%= ResolveUrl("~/Scripts/jquery-1.4.1.js") %>' type="text/javascript" ></script> 
<script type="text/javascript"> 

     $(document).ready(function() { 
      $(".cust_details").hide(); 
      $(".cust_summary").click(function() { 
       $(this).next(".cust_details").slideToggle(100); 
      }); 
     }); 

    </script> 

我沒有在我的應用程序的頭文件的jquery.js,所以我希望這是可以調用scri在這裏。這個應用程序有很多嵌套的母版頁,並不知道哪一個把調用jQuery文件。

頁面加載,中繼器填充,細節內容被隱藏。點擊彙總div時,什麼都不會發生 - 細節內容不會顯示。

有沒有人有任何想法如何讓這個顯示/隱藏div這樣工作?謝謝!

我使用VS2010,框架2.0,C#

+0

你檢查,看是否發生了任何JavaScript錯誤可能阻止您的代碼運行?乍一看,你的代碼對我來說看起來很好。 – Jacob 2011-01-07 05:17:22

回答

0

試試這個:

$(this).nextAll('div[class="cust_details"]').eq(0).slideToggle(100); 

我已經跑了一個快速的測試,它似乎是工作。

0

試試這個:

<script type="text/javascript"> 

     $(document).ready(function() { 
      $(".cust_details").hide(); 
      $(".cust_summary").click(function() { 
      $(this).nextAll('div[class="cust_details"]').eq(0).slideToggle(100); 
      }); 
     }); 

</script>