We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

How to display a CellValue in GGC, even if the value is not in LookupTable (ForeignKeyReference)?

Hi all,

I have a GGC bound to a Dataset with a Column that has a Relation to a LookupTable (RelationKind.ForeignKeyReference).
If there is a value in that Column that does not match a value in the LookupTable the Cell shows up empty. Is there a way to show the "wrong" value in the cell?

Thanks in advance and regards
Volker

1 Reply

AD Administrator Syncfusion Team November 1, 2006 09:15 AM UTC

Hi Volker,

Our apologies for the delay in response.

You can handle the Model.QueryCellFormattedText event of the GridTableControl and set the e.Text to e.Value to want to display. Use the e.Style.CellIdentity.RowIndex and e.Style.CellIdentity.ColIndex to get the row and column of the cell for which the displaytext has to be set. Below is a code snippet.

//Form Load Handler
this.gridGroupingControl1.TableControl.Model.QueryCellFormattedText +=new GridCellTextEventHandler(Model_QueryCellFormattedText);

private void Model_QueryCellFormattedText(object sender, GridCellTextEventArgs e)
{
if( e.Style.CellType == "ForeignKeyCell" && e.Value != null)
{
e.Text = e.Value.ToString() ;
e.Handled = true;
}
}

Here is a sample.
http://www.syncfusion.com/Support/user/uploads/ForeignKeyReference_34e6568e.zip

Let me know if this helps.

Best Regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon