0

I am working with this code and trying to implement a add row feature using footertemplate, but nothing in the footer row is showing. Because the gridview is nested and a panel is used for layout, I don't know how to get the footertemplate content to show. At this stage I just want anything to show below the nested gridview / panel.

The context:
1.There is a customer gridview
2.When users select a row, child gridview shows.
3.The child contains all orders of the selected customer.
4.I want to be able to show some controls below the last order in the expanded panel, so a new order can be added.
5.Where do I need to place the footertemplate, so the controls show in the panel.

<asp:GridView ID="gvCustomers" runat="server" AutoGenerateColumns="false" CssClass="Grid" DataKeyNames="CustomerID" OnRowDataBound="OnRowDataBound">
    <Columns>
        <asp:TemplateField>
            <ItemTemplate>
                <img alt = "" style="cursor: pointer" src="images/plus.png" />
                <asp:Panel ID="pnlOrders" runat="server" Style="display: none">
                    <asp:GridView ID="gvOrders" runat="server" AutoGenerateColumns="false" CssClass = "ChildGrid">
                        <Columns>                                <asp:BoundField ItemStyle-Width="150px" DataField="OrderId" HeaderText="Order Id" />
                            <asp:BoundField ItemStyle-Width="150px" DataField="OrderDate" HeaderText="Date" />
                        </Columns>
                    </asp:GridView>
                </asp:Panel>
            </ItemTemplate>
            <footertemplate>
                <asp:Button Text="Insert" CommandName="Insert" CausesValidation="true" runat="server" ID="btInsert" />
                <asp:Button Text="Cancel" CommandName="Cancel" CausesValidation="false" runat="server" ID="btCancel" />
                <asp:Label runat="server" Text="ggggggg">ddd</asp:Label>
            </footertemplate>
        </asp:TemplateField>
        <asp:BoundField ItemStyle-Width="150px" DataField="ContactName" HeaderText="Contact Name" />
        <asp:BoundField ItemStyle-Width="150px" DataField="City" HeaderText="City" />
    </Columns>
</asp:GridView>
SANM2009
  • 1,918
  • 2
  • 12
  • 30
  • 1
    I would recommend a nested `ListView` - the `GridView` control doesn't have the built-in functionality you are looking for. – Laslos Dec 19 '17 at 22:37
  • I'm not looking for built in functionality. If I can just add anything under the results of the child grid, I'll be able to achieve what I need. – SANM2009 Dec 20 '17 at 08:17
  • I managed to solve the issue by placing another panel inside the panel with the drop down list. – SANM2009 Dec 20 '17 at 21:56

0 Answers0