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 can i bind to GridComboBoxColumn's ItemsSource (in SfDataGrid) in code behind.

I need to bind to the GridComboBoxColumn ItemsSource in code behind. But I can't find a way to do it.
Is there a way to do it?

7 Replies

NJ Narayanasamy J Syncfusion Team December 17, 2013 01:08 PM UTC

Hi Om,

 

Thanks for contacting Syncfusion support.

 

We have analysed your query. In code behind by using BindingOperations.SetBinding method you can bind the ItemsSource for GridComboBoxColumn. We have prepared a sample based on this and it can be downloaded from the following location.

 

Sample link: GridComboBoxColumn.zip

 

Please let us know if you need further assistance.

 

Regards,

Narayanasamy

 



HE heromyth January 4, 2014 05:28 AM UTC

The link has broken.


JG Jai Ganesh S Syncfusion Team January 6, 2014 10:28 AM UTC

Hi heromyth,

 

We apologize for the inconvenience caused.

 

We faced some technical issue in our server, hence the sample was not downloaded from the uploaded link. However we have uploaded the sample again to the server and please find the sample location below,

 

Sample: GridComboBoxColumn.zip

 

Please let us know if you have any queries.

 

Thank you,

Jai Ganesh S



OT Om Thapa January 14, 2014 09:49 PM UTC

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




JG Jai Ganesh S Syncfusion Team January 29, 2014 08:36 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



VA Vlatko Atanasovski November 21, 2022 12:32 PM UTC

Hello, trying to download the code for setting BindingOperations.SetBinding on GridComboBoxColumn, but can't do it because of the below:


Can you try to attach some sample code again? Thanks



VS Vijayarasan Sivanandham Syncfusion Team December 9, 2022 08:02 PM UTC

Hi Vlatko Atanasovski,

We have prepared the sample to meet your requirement. Please find the sample in the attachment.

Regards,

Vijayarasan S

If this post is helpful, please consider Accepting it as the solution so that other members can locate it more quickly.


Attachment: Sample_5e987ca8.zip

Loader.
Live Chat Icon For mobile
Up arrow icon