C# datagrid未显示在TabContainer中

C# datagrid未显示在TabContainer中,c#,asp.net,gridview,C#,Asp.net,Gridview,我的代码中有一个ajaxtoolkit:TabContainer。我把gridview放进去了。但在我运行项目时,它没有显示网格视图。gridview很好,当数据不在TabContainer中时,它会显示数据 这是我的aspx代码: <ajaxToolkit:TabPanel ID="tbAgency" runat="server" HeaderText="Agency" > <ContentTemplate>

我的代码中有一个ajaxtoolkit:TabContainer。我把gridview放进去了。但在我运行项目时,它没有显示网格视图。gridview很好,当数据不在TabContainer中时,它会显示数据

这是我的aspx代码:

            <ajaxToolkit:TabPanel ID="tbAgency" runat="server" HeaderText="Agency"  >
                   <ContentTemplate>
                       <asp:GridView ID="grAgency" runat="server" CellPadding="4" 
                                                                ForeColor="#333333" GridLines="None" AutoGenerateColumns="False"
                                                                 Width="901px" style="cursor: pointer;" AllowPaging="True" 
                                                                 AllowSorting="True" PageSize="20">
                                                                <AlternatingRowStyle BackColor="White" />
                                                                <EditRowStyle BackColor="#7C6F57" />
                                                                <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
                                                                <HeaderStyle BackColor="green" Font-Bold="True" ForeColor="White" 
                                                                    Font-Size="Small" HorizontalAlign="Left" />
                                                                <PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
                                                                <RowStyle BackColor="#c9d9c9" Font-Size="Small" />
                                                                <SortedAscendingCellStyle BackColor="#F8FAFA" />
                                                                <SortedAscendingHeaderStyle BackColor="#246B61" />
                                                                <SortedDescendingCellStyle BackColor="#D4DFE1" />
                                                                <SortedDescendingHeaderStyle BackColor="#15524A" />
                                                                <Columns>
                                                                    <asp:BoundField HeaderText="Agency Name" DataField="Name" 
                                                                        ItemStyle-Wrap="true" ItemStyle-HorizontalAlign="Center">
                                                                    <HeaderStyle HorizontalAlign="Left" />
                                                                        <ItemStyle HorizontalAlign="Left" Wrap="True"></ItemStyle>
                                                                    </asp:BoundField>
                                                                    <asp:BoundField HeaderText="Description" DataField="Description" 
                                                                        ItemStyle-Wrap="true" ItemStyle-HorizontalAlign="Center">
                                                                    <HeaderStyle HorizontalAlign="Left" />
                                                                        <ItemStyle HorizontalAlign="Left" Wrap="True"></ItemStyle>
                                                                    </asp:BoundField>
                                                                    <asp:BoundField HeaderText="Contact Name" DataField="ContactName" 
                                                                        ItemStyle-Wrap="true" ItemStyle-HorizontalAlign="Center">
                                                                    <HeaderStyle HorizontalAlign="Left" />
                                                                        <ItemStyle HorizontalAlign="Left" Wrap="True"></ItemStyle>
                                                                    </asp:BoundField>
                                                                    <asp:BoundField HeaderText="Contact Phone" DataField="Phone" 
                                                                        ItemStyle-Wrap="true" ItemStyle-HorizontalAlign="Center">
                                                                    <HeaderStyle HorizontalAlign="Left" />
                                                                        <ItemStyle HorizontalAlign="Left" Wrap="True"></ItemStyle>
                                                                    </asp:BoundField>
                                                                    </Columns>
                                                                </asp:GridView>
                       <asp:Button ID="btnAddAgency" Text="Add Agency" runat="server" />
                       <asp:TextBox ID="txtAgencySearch" runat="server" />
                       <asp:Button ID="btnSearchAgency" runat="server" Text="Search" />
                    </ContentTemplate>    
           </ajaxToolkit:TabPanel>

将GridView放在选项卡面板的ContentTemplate内的ContentTemplate内的UpdatePanel内,并确保页面上有ToolkitScriptManager控件

<tabPanel>
     <contentTemplate>
          <updatePanel>
               <contentTemplate>
                     <gridview>

如果删除gridview并在选项卡中放置一些文本,文本是否正确显示?@RickS是的,它会显示文本。页面中有什么内容?你对grAgency做了什么吗?@RickS不,我在页面加载中没有任何与grAgency相关的内容
<tabPanel>
     <contentTemplate>
          <updatePanel>
               <contentTemplate>
                     <gridview>