2013-06-19 48 views
0

是否可以在不使用Jquery或java腳本的情況下在嵌套網格視圖中添加展開colapse功能。如何在不使用jQuery的情況下將展開/摺疊添加到嵌套Gridview中

如果有人可以給我一個例子嗎?

下面是我的嵌套的GridView

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
    BackColor="White" BorderColor="#E7E7FF" BorderStyle="None" BorderWidth="1px" 
    CellPadding="3" GridLines="Horizontal" 
    onrowdatabound="GridView1_RowDataBound" DataKeyNames="id1" > 
    <AlternatingRowStyle BackColor="#F7F7F7" /> 
    <Columns> 
     <asp:TemplateField HeaderText="ID"> 
      <ItemTemplate> 
       <asp:Label ID="Label1" runat="server" Text='<%# Eval("id1") %>'></asp:Label> 
      </ItemTemplate> 
     </asp:TemplateField> 
     <asp:TemplateField HeaderText="Students"> 
      <ItemTemplate> 
       <asp:GridView ID="GridView2" runat="server" CellPadding="4" ForeColor="#333333" 
        GridLines="None"> 
        <AlternatingRowStyle BackColor="White" ForeColor="#284775" /> 
        <EditRowStyle BackColor="#999999" /> 
        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /> 
        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /> 
        <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" /> 
        <RowStyle BackColor="#F7F6F3" ForeColor="#333333" /> 
        <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" /> 
        <SortedAscendingCellStyle BackColor="#E9E7E2" /> 
        <SortedAscendingHeaderStyle BackColor="#506C8C" /> 
        <SortedDescendingCellStyle BackColor="#FFFDF8" /> 
        <SortedDescendingHeaderStyle BackColor="#6F8DAE" /> 
       </asp:GridView> 
      </ItemTemplate> 
     </asp:TemplateField> 
    </Columns> 
    <FooterStyle BackColor="#B5C7DE" ForeColor="#4A3C8C" /> 
    <HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" /> 
    <PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" HorizontalAlign="Right" /> 
    <RowStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" /> 
    <SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="#F7F7F7" /> 
    <SortedAscendingCellStyle BackColor="#F4F4FD" /> 
    <SortedAscendingHeaderStyle BackColor="#5A4C9D" /> 
    <SortedDescendingCellStyle BackColor="#D8D8F0" /> 
    <SortedDescendingHeaderStyle BackColor="#3E3277" /> 

</asp:GridView> 
+0

它不可能做到這一點不使用JavaScript。 ajaxcontroltoolkit也使用JavaScript來達到這個目的。 – naveen

回答

相關問題