When I attempt to access a cell value in a grid that has multiple bands, the value returns the string "System.Data.RelatedView" instead of the real value that's displayed to the user.
How can I retrieve the actual value of this cell? I'm using the following code to access the cell text:
When I assign the data source, I set a data relation inside the DataSet object:
DataRelation Rel = new DataRelation("IDSalesHeaderInterface", SalesHeaderTable.Columns["IDSalesHeaderInterface"], SalesDetailTable.Columns["IDSalesHeaderInterface"]);
dataSet.Relations.Add(Rel);
Then, when I want to retrieve the value for the related column, I do:
foreach (var GridRow in gridOrdersToolbox.Rows) { if (GridRow != null && GridRow.Band.Index == 0 && GridRow.Selected) { string OrderId = GridRow.Cells["IDSalesHeaderInterface"].Text; if (!string.IsNullOrEmpty(OrderId)) { CopyText += OrderId + "\r\n"; } } }
This is where the string returned for the cell text is "System.Data.RelatedView". How to get the actual value?
Hello Richard,
Thank you for contacting .I notice that you are using the relation name IDSalesHeaderInterface is same as your column name .Try to use some other name for the relation and test if this help. All other code is looking correct to me.
Looking forward to hear you back.