可扩展的Gridview

时间:2012-05-22 06:31:13

标签: c# asp.net html gridview

我想使用可以扩展其行的网格视图,同时内部的行也应该能够扩展。所以基本上我希望看​​到三个级别的信息。我在Google上看过很多工具,但它们不是免费的,或者它们没有达到第3级。我也不想使用树网格视图对此有任何建议将非常感激。

提前致谢

这是我到目前为止所做的:

                    <asp:TemplateField>
                <ItemStyle CssClass="inv" Width="0" />
                <HeaderStyle CssClass="inv" Width="0"></HeaderStyle>
                <HeaderTemplate>
                    </th></tr></HeaderTemplate>
                <ItemTemplate>
                    </td>
                    <asp:PlaceHolder ID="Project" runat="server" Visible="False">
                        <tr>
                            <td colspan="1" style="border: 0px solid #fff; background-color: transparent;">
                            </td>
                            <td colspan="9"  style="padding: 0px; padding-top: 3px; padding-bottom: 7px; border-right-width: 0px;
                                border-bottom-width: 0px; background-color: #FFFFFF;">
                                <asp:UpdatePanel runat="server" ID="ChildControl">
                                    <ContentTemplate>
                                        <asp:LinkButton ID="lbtnAddDeliverable" runat="server" OnClick="lbtnAddDeliverable_Click"
                                            Height="17px">Add Deliverable </asp:LinkButton>&nbsp; &nbsp;
                                        <asp:GridView ID="grid0" runat="server" AllowPaging="True" DataKeyNames="DeliverableID"
                                            AutoGenerateColumns="False" CellPadding="4" ForeColor="#333333" GridLines="None"
                                            OnRowDataBound="grid0RowDataBound"
                                            OnRowCommand="grid0_RowCommand" Width="970px" DataSourceID="odsGetDelivbyProjects">
                                            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                                            <Columns>
                                                <asp:BoundField DataField="DeliverableID" HeaderText="DeliverableID" SortExpression="DeliverableID" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left"
                                                    HeaderStyle-CssClass="invisible" ItemStyle-CssClass="invisible">
                                                    <HeaderStyle CssClass="invisible" />
                                                    <ItemStyle CssClass="invisible" />
                                                </asp:BoundField>
                                                <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" HeaderStyle-CssClass="invisible" ItemStyle-CssClass="invisible" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left"/>
                                                <asp:TemplateField HeaderText="Name" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left">
                                                    <ItemTemplate>
                                                        <asp:LinkButton ID="lbtnEditDeliverable"  CommandName="EditDeliverable" runat="server" OnClick="lbtnEditDeliverable_Click"> Edit Deliverable</asp:LinkButton>
                                                    </ItemTemplate>
                                                </asp:TemplateField>
                                                <asp:BoundField DataField="Description" HeaderText="Description" SortExpression="Description" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left"/>
                                                <asp:BoundField DataField="StartDate" HeaderText="StartDate" SortExpression="StartDate" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left"/>
                                                <asp:BoundField DataField="EndDate" HeaderText="EndDate" SortExpression="EndDate" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left"/>

                                                <asp:TemplateField HeaderText="" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left">
                                                    <ItemTemplate>
                                                        <asp:LinkButton ID="lbtnAddDelivResource" CommandName="DeliverableResource" runat="server" OnClick="lbtnAddDelivResource_Click"> Add Resources</asp:LinkButton>
                                                    </ItemTemplate>
                                                </asp:TemplateField>
                                                <asp:TemplateField HeaderText="" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left">
                <ItemTemplate>
                    <asp:LinkButton ID="DeleteButton" runat="server" CausesValidation="False" CommandName="Delete"
                        Text="Delete" OnClientClick="return confirm('Are you certain you want to delete this Delivirable?');">
                    </asp:LinkButton>
                </ItemTemplate>
            </asp:TemplateField>
                                                <%--                                <asp:TemplateField HeaderText="">
                <ItemTemplate>
            <asp:LinkButton ID="lbtnAddDeliverable" runat="server"  OnClick="lbtnAddDeliverable_Click"
        Height="17px">Add Deliverable </asp:LinkButton>
                    </ItemTemplate>
            </asp:TemplateField>--%>
                                            </Columns>
                                            <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>
                                        <borderskin bordercolor="Transparent" />
                                        <div class="graph_aux" style="font-size: .7em;">
                                            <span></span>
                                        </div>
                                        <asp:ObjectDataSource ID="odsGetDelivbyProjects" runat="server" SelectMethod="CallDeliverableDetails"
                                            TypeName="Pbel_Resource_Management.Classes.Object_Classes.Projects.ProjectCalls">
                                            <SelectParameters>
                                                <asp:SessionParameter Name="ProjectID" SessionField="DeliverableFromProject" Type="Int32" />
                                            </SelectParameters>
                                        </asp:ObjectDataSource>
                                    </ContentTemplate>
                                </asp:UpdatePanel>
                            </td>
                        </tr>
                    </asp:PlaceHolder>
                </ItemTemplate>
            </asp:TemplateField>

1 个答案:

答案 0 :(得分:2)

您可以Tree like Gridview « Teme on .NET

执行此操作