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.

IList binding and non-value-type properties

Thread ID:

Created:

Updated:

Platform:

Replies:

3097 Mar 2,2003 08:38 PM Mar 4,2003 03:28 AM Windows Forms 4
loading
Tags: GridControl
Apolon Ivankovic
Asked On March 2, 2003 08:38 PM

Does Essential Grid support arbitrary object types as properties when binding an IList to the data bound grid? Or is it limited to the common primitive/value types? For example, I have a list of account entry objects and the account entry object has a property called Payee which points to an IParty object. I'd like to display the Payee name in the grid and also allow the user to select from a list of common payees within the grid. I've tried just setting the property name "Payee" as the grid column's MappingName. I've also tried using "Payee.Name" to select the appropriate "sub-property". Is there an easy way of getting the Payee name into the grid via designer settings or do I have to resort to event processing for this scenario?

Administrator [Syncfusion]
Replied On March 3, 2003 11:55 AM

You could specify "ChoiceList" (or "GridListControl") as celltype, set the column's MappingName to "Payee" and the DisplayMember to the field that you want to display, e.g. "Name". You also need to have access to the collection with all the payees you want to display. Example: column.StyleInfo.CellType = "GridListControl"; column.StyleInfo.DisplayMember = "Name"; column.StyleInfo.DataSource = yourListWithAllPayees; column.StyleInfo.ValueMember = ""; // leave empty so that object ittself is stored and not a key that represents the object. Let me know if you run into any problems. Stefan

Apolon Ivankovic
Replied On March 3, 2003 08:37 PM

The settings you suggested result in the correct list of payee options for both a ComboBox or a GridListControl cell type, but the text for the payee name doesn't get displayed in the textbox portion of the cell. This is with ValueMember = ""; Interestingly if I use ValueMember = "." or set to null, then the cell does display the correct payee's name but in a "shadowed" font! What is the significance of the display of a shadowed font in a grid cell? I then added a "Self" property to the IParty interface which always returns the C# this. Setting ValueMember = "Self" now results in the correct payee name being displayed and in the expected font. This is not ideal, but works for the display side of things. Also, should I be able to use dot notation to bind a sub-property to a cell? I don't seem to be able to successfully do this. Thanks, Apolon.

Apolon Ivankovic
Replied On March 4, 2003 01:06 AM

I put together a smaller version of the application I'm working on to illustrate the object binding functionality. Now the smaller app. behaves as you indicated for ValueMember = ""; i.e. it does display the person/party name in the cells when the grid is first displayed. Can't find the difference between the two apps which results in the differing behaviour. I've still got problems with the setting actions, but this will be put in via DirectTrac. Thanks, Apolon.

Administrator [Syncfusion]
Replied On March 4, 2003 03:28 AM

Ok, thanks. I'll also review the combobox cell type source code again if there is anywhere a check for ValueMember = "" that might be wrong. But in general this should work without problem. Stefan

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.

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.

;