English 中文(简体)
在C#中制作一张刺片的 Gri格
原标题:Creating a tabbed Gridview in C#
  • 时间:2009-10-21 20:25:20
  •  标签:

我正在创建一个网络接口,该接口目前可从XML数据文档中读取数据,将其分为一系列物体,之后,我对概览的数据来源加以约束。 然后,我使用并检索每栏各物体的数据。

然而,我当时想在本网格中有多个表格,可能由不同的连接纽州控制。 每个表格将显示一套不同的栏目。

如何以最佳方式执行? 我是否需要在我的网页上另外有三句格里德文,只是显示用户选择的电文(以点击连接塔顿为基础),同时隐藏所有其他的电文? 这似乎过于缓慢。 是否有可能通过一份GridView?

如今,整个GredView都载于AJAX更新小组,其代码如下:

<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>

这是我目前拥有的一张网格座标书,该表的内容。 根据jdk的答复,我如何在第二和第三个表格中增加其他模板领域,然后在点击表链路塔顿时,在显示不同装置之间转用?

感谢!

最佳回答

当有多口格里德意见时,页面观测会变得非常(不一定)大(见由此形成的超文本源代码和寻找“_VIEWSTATE”。 你可以像你说过的那样,使用一种GridView控制,并根据最近点击的CLinkButton(a.k.a.“tab”)将适当的数据输入该系统。

如果这也是一种稀有的数据假设,你可以储存一套三套数据中每一套数据目前页数的简便的三套数据,这样,在数据单单单单单单单单单控制中和之外,你可以显示最新数据页。

然而,如果带宽不是令人关切的问题(即,如果该网页确实受到很多的点击或在内联网上运行),那么对优化带宽则不会感到担忧。

问题回答

我以前做了类似的事情。 我使用了GridView模板栏。 http://www.asp.net/AJAX/AjaxControlToolkit/Samples/Tabs/Tabs.aspx” rel=“nofollow noreferer”>Ajax控制工具包,在GridView中标/a。

我也许会形成一种习俗性复合控制(作为刺伤者),并将电网的观点添加到这里。 我不会把它束缚在一边。





相关问题
热门标签