Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
15
UltraGridCell.Text returns "System.Data.RelatedView"
posted

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?

  • 7535
    Offline posted

    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.