【问题标题】:Dynamically Copy/Create the Full Structure of an Asp.NET Grid View动态复制/创建 Asp.NET 网格视图的完整结构
【发布时间】:2011-05-22 20:15:15
【问题描述】:

好的,我在 .aspx 页面上创建了一个 GridView,它具有我想要的确切结构。如何在代码隐藏中复制它?与 TemplateFields 和 ItemTemplates 结构完全相同的副本?

如果无法复制,如何在代码隐藏中重现 GridView?添加 TemplateFields、ItemTemplates 等。

我为什么要这样做?对于数据库的每一列,我需要一个单独的、相同的 GridView。我一直在环顾四周,只找到了一种用于动态制作网格的资源(请参阅下面的资源)。考虑到我的时间限制,我想简单地复制我已经拥有的那个。

资源:http://bytes.com/topic/asp-net/answers/624380-gridview-generated-programmatically

【问题讨论】:

    标签: c# asp.net templates gridview dynamic


    【解决方案1】:

    您可以使用网格视图创建User Control。这将允许您创建该结构的多个实例。如果它是通过编程方式创建的,您最好创建一个Web Server Control,这样您可以更好地控制页面。

    【讨论】:

    • 这是个好主意!我会试一试。 :)
    猜你喜欢
    • 2013-12-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-09-11
    • 1970-01-01
    • 2012-01-18
    相关资源
    最近更新 更多