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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to bind to sub-property

Thread ID:

Created:

Updated:

Platform:

Replies:

67349 Aug 15,2007 04:41 AM UTC Aug 16,2007 01:44 PM UTC Windows Forms 1
loading
Tags: GridControl
Kent Boogaart
Asked On August 15, 2007 04:41 AM UTC

Hi,

I am using the GridDataBoundGrid. I want to bind certain columns to sub-properties of my business objects.

For example, suppose you have:

public class Address
{
public string Suburb;
}

public class Person
{
public string Name;
public Address Address;
}

I want one column bound to "Name" and one column bound to "Address.Suburb". The first binding works but the second just shows a blank column.

Any help appreciated.

Jeba S [Syncfusion]
Replied On August 16, 2007 01:44 PM UTC

Hi Kasey,

Thank you for posting query to us.

Please refer this sample which shows how to bind the subproperty in GridDataBoundGrid.
http://websamples.syncfusion.com/samples/Grid.Windows/F67349GDBG/main.htm

The column titled "Address Workaround" uses C# code to access the sub-property. If you would like to set MappingName to "Payee.Address" to bind to the Address property of the Payee property of an Entry "row object". Then you will let the CellValue return the "row object", and you can use the DisplayMember to point to a property in this 'row object'. (If you set the GridStyleInfo.ShowButtons property to GridShowButtons.Hide, then you would not know the cell was a combobox.)


gridDataBoundGrid1.Binder.InternalColumns[0].StyleInfo.ShowButtons = Syncfusion.Windows.Forms.Grid.GridShowButtons.Hide;


Thank you for using Syncfusion Products.

Best Regards,
Jeba.


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;