繁体   English   中英

将Infragistics UltraGridRow转换为DataRow

[英]Convert Infragistics UltraGridRow to DataRow

有没有简单的方法将infragistics UltraGridRow转换为标准的DataRow对象?

如果已将UltraGrid的DataSource设置为DataTable,则可以使用当前ActiveRow提取基础DataRow

 if(grid.ActiveRow != null && grid.ActiveRow.IsDataRow)
 {
      DataRow row = (grid.ActiveRow.ListObject as DataRowView).Row;
 }

当然,您可以将此示例的ActiveRow替换为IsDataRow属性为true的每个UltraGridRow(谨防SummaryRows和OutlookGroupByRow)

请注意,如果将List<CustomClass>绑定到DataSource,则ListObject能够返回CustomClass的单个实例

如果我没记错的话,您可以通过以下方式访问基础DataRow

var myDataRow = ((DataRowView)myUltraGridRow.ListObject).Row;

给出grid.DataSource对象是DataTable或DataSet的前提条件。

使用UltraGridRow的ListObject属性获取基础数据项。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM