我的.aspx
页面代码如下所示。在这里,我将一些产品绑定到父grid(grdPBase)
,将某些产品绑定到childgrid(grdPFamily)
,同样我也将一些产品添加到他们的子网格中。
问题是,如果我点击第一个加号,那么除了当前加上符号全部应该处于可折叠模式。
<div id="style_1" class="scrollbar h450">
<asp:GridView ID="grdPBase" runat="server" class="font15" margin-left="10px" paddding-left="15px"
AutoGenerateColumns="false"
GridLines="None" DataKeyNames="ProductID" ShowHeader="False" OnRowDataBound="OngrdPBaseRowDataBound"
OnSelectedIndexChanged="OngrdPBaseSelectedIndexChanged">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:ImageButton ID="imgPFamilyShow" runat="server" OnClick="imgPFamilyShow_Click"
class="outlinenone" ImageUrl="~/Images/plus.png" CommandArgument="Show" />
<asp:Panel ID="pnlPFamily" runat="server">
<asp:GridView ID="grdPFamily" runat="server" OnRowDataBound="OngrdPFamilyRowDataBound"
margin-left="10px" paddding-left="15px"
OnSelectedIndexChanged="OngrdPFamilySelectedIndexChanged" class="font15 mtop8 mleft10"
AutoGenerateColumns="false" DataKeyNames="ProductID" GridLines="None"
ShowHeader="False">
<Columns>
<asp:TemplateField ItemStyle-CssClass="hs">
<ItemTemplate>
<asp:ImageButton ID="imgPClassShow" runat="server" OnClick="imgPClassShow_Click"
class="outlinenone" ImageUrl="~/Images/plus.png" CommandArgument="Show" />
<asp:Panel ID="pnlPClass" runat="server">
<asp:GridView ID="grdPClass" runat="server" class="mtop8 font15"
DataKeyNames="ProductID" AutoGenerateColumns="false" OnRowDataBound="OngrdPClassRowDataBound"
OnSelectedIndexChanged="OngrdPClassSelectedIndexChanged" GridLines="None" ShowHeader="False">
<Columns>
<asp:TemplateField ItemStyle-CssClass="hs">
<ItemTemplate>
<asp:ImageButton ID="imgPLineShow" runat="server" OnClick="imgPLineShow_Click" class="outlinenone"
ImageUrl="~/Images/plus.png" CommandArgument="Show" />
<asp:Panel ID="pnlPLine" runat="server">
<asp:GridView ID="grdPLine" runat="server" class="mtop10 font15"
DataKeyNames="ProductID" OnRowDataBound="OngrdPLineRowDataBound" OnSelectedIndexChanged="OngrdPLineSelectedIndexChanged"
AutoGenerateColumns="False" GridLines="None" ShowHeader="False">
<Columns>
<asp:BoundField DataField="ProductID" HeaderText="PLineID" ItemStyle-CssClass="hidden" />
<asp:BoundField DataField="ProductName" HeaderText="PLineName" ItemStyle-CssClass="hidden" />
<asp:TemplateField>
<ItemTemplate>
<asp:Label runat="server" ID="lblPLine" class="Plinecolor" Text="" ForeColor="#800000"
Font-Size="14px"></asp:Label>
<asp:LinkButton ID="lnkDeletePLine" runat="server" class="font12" OnClick="lnkDeletePLine_Click"
OnClientClick="return confirm('Are you sure you want delete?')">
<i class="glyphicon glyphicon-trash"></i></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</asp:Panel>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="ProductID" HeaderText="PClassID" ItemStyle-CssClass="hidden" />
<asp:BoundField DataField="ProductName" HeaderText="PClassName" ItemStyle-CssClass="hidden" />
<asp:TemplateField>
<ItemTemplate>
<asp:Label runat="server" ID="lblPClass" class="Pclasscolor" ForeColor="Blue" Font-Size="15px"
Text=""></asp:Label>
<asp:LinkButton ID="lnkDeletePClass" runat="server" class="font12" OnClick="lnkDeletePClass_Click"
OnClientClick="return confirm('Are you sure you want delete?')">
<i class="glyphicon glyphicon-trash"></i></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</asp:Panel>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="ProductID" HeaderText="PFamilyID" ItemStyle-CssClass="hidden" />
<asp:BoundField DataField="ProductName" HeaderText="PFamilyName" ItemStyle-CssClass="hidden" />
<asp:TemplateField>
<ItemTemplate>
<asp:Label runat="server" ID="lblPFamily" ForeColor="#800000" class="font14" Text=""></asp:Label>
<asp:LinkButton ID="lnkDeletePFamily" runat="server" class="font12" OnClick="lnkDeletePFamily_Click"
OnClientClick="return confirm('Are you sure you want delete?')">
<i class="glyphicon glyphicon-trash"></i></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</asp:Panel>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="ProductID" HeaderText="PBaseID" ItemStyle-CssClass="hidden" />
<asp:BoundField DataField="ProductName" HeaderText="PBaseName" ItemStyle-CssClass="hidden" />
<asp:TemplateField>
<ItemTemplate>
<asp:Label runat="server" ID="lblPBase" class="Pbasecolor font15" Text="" ForeColor="#3e3e5b"></asp:Label>
<asp:LinkButton ID="lnkDeletePBase" runat="server" class="font12" Font-Bold="true"
OnClick="lnkDeletePBase_Click" OnClientClick="return confirm('Are you sure you want delete?')">
<i class="glyphicon glyphicon-trash"></i></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:LinkButton ID="lnkDummy" runat="server"></asp:LinkButton>
</div>