【问题标题】:how to get all the rows as well as the column headers from the datagrid to a list如何将所有行以及列标题从数据网格获取到列表
【发布时间】:2009-04-02 20:58:01
【问题描述】:

我目前正在研究 wingrid。在那..数据显示在wingrid中之后,我想将网格中的所有行带到新列表中,包括列标题。

在windows datagrid中,我们将采用这样的列标题。

List cols = new List(); // 填充 foreach(Datagrid.Columns 中的 ColumnHeader 列){ cols.Add(列); }

但在 wingrid 中没有名为 columnHeader 的类...

请告诉我如何将列名以及网格中的行添加到新列表中。

问候,

Ram N

【问题讨论】:

  • 您是在谈论 .NET 附带的 WinForms Datagrid,还是使用 Infragistics 的 UltraWinGrid?

标签: c#


【解决方案1】:

如果您使用默认的 System.Windows.Forms.Datagrid,那么它将是 DataGridColumnStyle 对象的 HeaderText 属性,该对象包含在活动 DataGridTableStyleGridColumnStyles 属性中Datagrid.TableStyles 属性。

如果“wingrid”是指 Infagistics WinGrid (Infagistics.Win.UltraWingrid),则表示 Layouts 集合中活动 UltraGridLayout 的 Bands 集合中活动 UltraGridBand 的 Columns (a ColumnsCollection) 属性UltraGrid 对象似乎就是您所追求的。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-09-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-06-03
    • 2015-07-02
    • 1970-01-01
    相关资源
    最近更新 更多