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

How to bind to the GridComboBoxColumn's ItemsSource?

Hi,
I am using the index binding as MappingName for a GridComboBoxColumn. And I need to get the item source from the same object I am bound to. But I can't figure out how to do it.
Scenario: I have a Customer object which has a dictionary containing cells. So, 
MappingName  is something like "Cells[CellName].Value". And the item source is also in the same object pointed by the binding "Cells[CellName].ComboBoxList".

I tried to use the BindingOperations, as you explained above but I don't have the source to bind to, as it is determined dynamically by the grid.
Thanks,
Om

8 Replies

SM Saravanan M Syncfusion Team January 23, 2014 11:43 AM UTC

Hi Om,

Thank you for contacting Syncfusion support, 

We have analyzed you query. It you want to set item source for combo box you need to create collection for the combo box and you can set as item source to combo box. Please refer the below code snippet.

Code snippet[C#]:

GridDataColumnStyle columnstyle = new GridDataColumnStyle();

columnstyle.CellType = "ComboBox";

columnstyle.ItemsSource = ItemList;

 

We have prepared a sample based on your requirement and you can download it from below location.

 

Sample location: GridDataControlSample combobox.zip

 

Please let us know if this sample helps you,

Regards,

Saravanan.M



OT Om Thapa January 23, 2014 07:43 PM UTC

Hi Saravanan,

I am sorry I forgot to mention that I was having this issue in SfDataGrid. The solution you provided is for GridDataControl. 

Thanks,
Om


JG Jai Ganesh S Syncfusion Team January 29, 2014 08:37 AM UTC

Hi Om,

 

Thank you for using Syncfusion products.

 

We have analyzed your query. You can not directly set the index binding as a ItemSource  for a GridComboBoxColumn. However you can achieve your requirement by writing the  Custom GridCellComboBoxRenderer class and override the OnInitializedEditElement method. We have prepared the sample based on this and please find the sample under the following location,

 

Sample: SfDataGridComboboxSample Dictionary.zip

 

Please let us know if you need further assistance.

 

Thank you,

Jai Ganesh S



OT Om Thapa January 30, 2014 10:45 PM UTC

Hello Jai,

With the sample code you posted, I can now bind to the ItemSource. However, if I change the droplist value it doesn't reflect the change in the cell (Cell is blank) even though it changes the value of the model object. I see the same issue with your sample code.
Thanks,
Om 


JG Jai Ganesh S Syncfusion Team February 4, 2014 05:03 AM UTC

Hi Om,

 

Thank you for your update.

 

We have analyzed your query. We are unable to reproduce the reported issue in our sample. Could you please share your sample along with the replication procedure? This would be more helpful for us to serve you in a better way.

 

Please let us know if you need further assistance.

 

Thank you,

Jai Ganesh S



OT Om Thapa February 4, 2014 02:50 PM UTC

Jai,

I can easily reproduce the issue I mentioned above. This is what I am doing.
In the sample program that you have attached in this forum, change the droplist value to something. At this point it looks like value is selected, however as soon as you move to a different row or column, the value disappears and grid cell is empty.

Thanks,
Om

 


JG Jai Ganesh S Syncfusion Team February 13, 2014 09:00 AM UTC

Hi Om,

 

Thank you for your update.

 

We have tested the sample based on your scenario but we are unable to reproduce the issue. Please find the video illustrating this attached below.

 

Video: SampleVideo.zip

 

Please let us know if you have any queries.

 

Thank you,

Jai Ganesh S



ST steohly July 21, 2014 09:21 AM UTC

Hi, even i have the same problem of the cell not getting updated to the value selected. Could you please tell me how you resolved this problem.

Loader.
Live Chat Icon For mobile
Up arrow icon