Hello!
I am creating a web interface which currently reads data in from an XML data file, parses it into an array of Objects, after which I bind it to the data source of a Gridview. I then use and to retrieve the data I want from the objects for each column.
However, I am at the point that I would like to have multiple tabs in this gridview, possibly controlled by different link buttons. Each tab would show a different set of columns.
What would be the best way to implement this? Do I need to have three separate GridViews in my page, and just show the one for which the user selected (based on the click to the link button), while hiding all the others? This seemed like it might be unnecessarily slow. Is it possible to do via one GridView?
Right now the entire GridView is contained in an AJAX update panel, with the code below:
<asp:Panel id="searchResultsGrid" runat="server" CssClass="searchResultsGrid">
<asp:GridView id="gridViewSearchResults" runat="server" AutoGenerateColumns="false"
AllowPaging="True" AllowSorting="True"
PageSize="25" Width="920" PagerSettings-Visible="false">
<Columns>
<asp:templatefield headertext="Test Column 1 Tab 1" HeaderStyle-HorizontalAlign="Left">
<itemtemplate>
<%# GetColumnInfo() %>
</itemtemplate>
</asp:templatefield>
<asp:templatefield headertext="Test Column 2 Tab 1" HeaderStyle-HorizontalAlign="Left">
<itemtemplate>
<%# GetColumnInfo() %>
</itemtemplate>
</asp:templatefield>
<asp:templatefield headertext="Test Column 3 Tab 1" HeaderStyle-HorizontalAlign="Left">
<itemtemplate>
<%# GetColumnInfo() %>
</itemtemplate>
</asp:templatefield>
<asp:templatefield headertext="Test Column 4 Tab 1" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right">
<itemtemplate>
<%# GetColumnInfo() %>
</itemtemplate>
</asp:templatefield>
<asp:templatefield headertext="Test Column 5 Tab 1" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right">
<itemtemplate>
<%# GetColumnInfo() %>
</itemtemplate>
</asp:templatefield>
<asp:templatefield headertext="Test Column 6 Tab 1" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right">
<itemtemplate>
<%# GetColumnInfo() %>
</itemtemplate>
</asp:templatefield>
<asp:templatefield headertext="Test Column 7 Tab 1" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right">
<itemtemplate>
<%# GetColumnInfo() %>
</itemtemplate>
</asp:templatefield>
</Columns>
<RowStyle CssClass="searchResultEntry borderTopGrey" />
<EmptyDataTemplate>
<p class="searchResultsEmpty">
<asp:Label ID="lblSearchResultsEmpty" runat="server" Text="No records matched the selected criteria. Please revise your criteria and try again." CssClass="searchResultsEmpty"></asp:Label>
</p>
</EmptyDataTemplate>
</asp:GridView>
</asp:Panel>
This is the code I currently have for one gridview, with the content of one tab. Based on jdk's response, how would I go about adding other TemplateFields for the second and third tabs, and then switching between displaying the different sets when a tab link button is clicked?
Thanks!