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

Wrong display of TreeGridComboBoxColumn

The configuration of the DisplayMemeberPath isnt used to display the value in the combobox.

Example :

public class Person
{
       public string FirstName {get;set;}
       public int CountryId {get;set}
}
public class Country
{
       public int Id {get;set}
       public string Name {get;set}
}

Let's consider a SfTreeGrid bind to a list of persons and with a column defined so :

 <Syncfusion:TreeGridComboBoxColumn DisplayMemberPath="Name"
                              HeaderText="Country"
                              ItemsSource="{Binding DataContext.Countries, RelativeSource={RelativeSourceAncestorType=referenceDataManagement:PersonEditorView}}"
                              MappingName="CountryId"
                                                                              ValueBinding="{Binding CountryId,Mode=TwoWay}"
                              SelectedValuePath="Id"/>


Then, the bind is working correctly (update the country of the person) but always the Id is displayed instead of ther Country name.

Thanks for your help.

3 Replies

MK Muthukumar Kalyanasundaram Syncfusion Team December 8, 2016 05:23 PM UTC

Hi Bpedroni, 

Thank you for contacting Syncfusion support. 
  
We have checked your code snippet.  In that you have binding the CountryId for MappingName . Hence the CountryId value is displayed in grid cell. If you want to display the TreeGridComboBoxColumn based on CityName, then you need to bind the CityName property to MappingName. By default, the TreeGridComboBoxColumn of MappingName property value will be shown in grid cell instead of DisplayMemberPath property value and the SelectedValuePath property is used to get the selected path value of the selected item. The comboBox items will be shown based on DisplayMemberPath. This is the behavior of SfTreeGrid. Could you please refer the below UG document link for further reference, 
  
  
Please let us know if you have any concerns. 

Regards, 
Muthukumar K 



BP Bpedroni December 12, 2016 09:33 AM UTC

Hello,

Your solution means that the Country Name (not the CityName) is exposed in the Person class.

In my example, only the Country Id is exposed in the class and should be, so the bind has to be done on the Id and display the name in the list.

If I do exactly the same but with a SfGridView and with this column :

 <Syncfusion:GridComboBoxColumn DisplayMemberPath="Name"
                               HeaderText="Country"
                               ItemsSource="{Binding DataContext.Countries, RelativeSource={RelativeSourceAncestorType=referenceDataManagement:PersonEditorView}}"
                               MappingName="CountryId"
                                                                              ValueBinding="{Binding CountryId,Mode=TwoWay}"
                              SelectedValuePath="Id"/>

then it works correctly.

Can the behavior be the same for treeview please ?

Thanks.


MK Muthukumar Kalyanasundaram Syncfusion Team December 13, 2016 10:43 AM UTC

Hi Bpedroni, 

Sorry for the inconvenience caused. 

We are able to reproduced the “Wrong display of TreeGridComboBoxColumn” issue. A support incident to track the status of this issue has been created under your account. Please log on to our support website to check for further updates. 
  
  
Please let me know if you have any questions. 
  
Regards, 
Muthukumar K 


Loader.
Up arrow icon