0
我有一個ajaxtoolkit:TabContainer在我的代碼。我把它放在gridview裏面。但是當我運行該項目時它沒有顯示網格視圖。 gridview很好,當它不在TabContainer中時顯示數據。datagrid它不顯示在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>
,這是我的C#代碼,當下拉菜單的變化,它顯示在網格數據(但電網是唯一可見的,當它是外面的。該選項卡,當我把在標籤裏面消失。
protected void ddlPartnerList_SelectedIndexChanged(object sender, EventArgs e)
{
Aid = Convert.ToInt32(ddlPartnerList.SelectedItem.Value);
if (Aid != 0)
{
Session["Aid"] = Aid;
TabContainer1.ActiveTabIndex = 0;
var AgencyList = adminmv.getAgency(Aid);
grAgency.DataSource = AgencyList;
grAgency.DataBind();
}
}
如果您刪除gridview並在選項卡中放置一些文本,文本是否正確顯示? –
@RickS是的,它顯示文字。 – nikta
你的Page_Load有什麼?你在那裏做什麼事? –