GridView在ASP.NET的Tab容器中显示为空

时间:2019-02-05 19:41:31

标签: c# html gridview tabs

我试图通过Bootstrap(也是ajax选项卡容器)在选项卡容器中包含gridview,而两者都返回空的gridview。

我已经完成了(!IsPostBack)下的Databind()并且gridview在选项卡外部可以正常工作,但是如果在选项卡中,则返回“无未决请求”。

如果要在容器内显示gridview怎么办?谢谢。

gridview outside the tab

<div class="nav-tabs-custom">
    <ul class="nav nav-tabs pull-right">
        <li class=""><a href="#tab_1-1" data-toggle="tab" aria-expanded="false">Tab 1</a></li>
        <li class="pull-left header"><i class="fa fa-th"></i>Custom Tabs</li>
    </ul>
    <div class="tab-content">
        <div class="tab-pane" id="tab_1-1">
            <div class="box-header">
                <h3 class="box-title">Pending Stationery Request</h3>
            </div>
            <div class="box-body">
                <div class="form-group">
                    <asp:GridView ID="GridView5" ShowFooter="True" CellPadding="4" GridLines="None" DataKeyNames="OrderId"
                        AutoGenerateColumns="False" runat="server" CellSpacing="4" OnRowDataBound="OnGvPendingRowDataBound" AllowPaging="true" PageSize="10" OnPageIndexChanging="OnGvPendingPaging">
                        <Columns>
                            <asp:TemplateField>
                                <ItemTemplate>
                                    <img alt="" style="cursor: pointer" src="../Images/plus.png" />
                                    <asp:Panel ID="pnlPendingOrderDetails" runat="server" Style="display: none">
                                        <asp:GridView ID="gvPendingOrderDetails" runat="server" AutoGenerateColumns="false" CssClass="ChildGrid">
                                            <Columns>
                                                <asp:TemplateField HeaderText="Image">
                                                    <ItemTemplate>
                                                        <image src="../Images/Catalogue/<%# Eval("ItemId") %>.jpg" width="45" height="45"></image>
                                                    </ItemTemplate>
                                                </asp:TemplateField>
                                                <asp:BoundField ItemStyle-Width="200px" DataField="Description" HeaderText="Description" />
                                                <asp:BoundField ItemStyle-Width="150px" DataField="OrderQty" HeaderText="Order Quantity" />
                                            </Columns>
                                        </asp:GridView>
                                    </asp:Panel>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:BoundField ItemStyle-Width="150px" DataField="RequestDate" DataFormatString="{0:dd/MM/yyyy}" HeaderText="Request Date">
                                <ItemStyle Width="150px"></ItemStyle>
                            </asp:BoundField>
                            <asp:BoundField ItemStyle-Width="150px" DataField="EmployeeId" HeaderText="Employee ID">
                                <ItemStyle Width="150px"></ItemStyle>
                            </asp:BoundField>
                            <asp:BoundField ItemStyle-Width="150px" DataField="EmployeeName" HeaderText="Employee Name">
                                <ItemStyle Width="150px"></ItemStyle>
                            </asp:BoundField>
                            <asp:BoundField ItemStyle-Width="150px" DataField="Status" HeaderText="Status">
                                <ItemStyle Width="150px"></ItemStyle>
                            </asp:BoundField>
                            <asp:TemplateField>
                                <ItemTemplate>
                                    <asp:Button ID="btnReject" runat="server" Text="Reject" OnClick="btnReject_Click" /><asp:Button ID="btnApprove" runat="server" Text="Approve" OnClick="btnApprove_Click" />
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                    </asp:GridView>
                    <asp:Label ID="Label5" runat="server" Text="No pending requests"></asp:Label>
                </div>...

0 个答案:

没有答案