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 to reset data Source for a particular Combo Box cell during run time?

Hi there,

I need to change the Data Source for Combo Box Cell in every row. For that i am writing like this but it is not working
                    var style = this.griddataBoundGrid[griddataBoundGrid.CurrentCell.RowIndex, 8];
                    style.DataSource = dt;
                    style.DisplayMember = "Name";
                    style.ValueMember = "cmp2";    
and another method 
                    GridCurrentCell cc = griddataBoundGrid.CurrentCell;                    
                    griddataBoundGrid[cc.RowIndex, cc.ColIndex].ResetDataSource();
                    griddataBoundGrid[cc.RowIndex, cc.ColIndex].DataSource=dt;
                    griddataBoundGrid[cc.RowIndex, cc.ColIndex].DisplayMember = "Name";
                    griddataBoundGrid[cc.RowIndex, cc.ColIndex].ValueMember = "cmp2";

both the functions are not working, there is any other way to do this.

1 Reply

MS Maniratheenam Sehar Syncfusion Team April 25, 2014 11:39 AM UTC

Hi Carleone Pratap,

Thank you for your interest in Syncfusion products.

We would like to suggest you by using GridComboBoxCellRenderer in ‘CurrentCellShowedDropDown’ event you can change the Datasource for the ComboBox cell. We added a code snippet below for your better understanding.

CodeSnippet[C#]:

void gridDataBoundGrid1_CurrentCellShowedDropDown(object sender, EventArgs e)

                        {

                        GridComboBoxCellRenderer renderer = cc.Renderer as GridComboBoxCellRenderer;

                       renderer.ListBoxPart.DataSource = dt;

                       renderer.ListBoxPart.ValueMember = "cntry_Id";

                       renderer.ListBoxPart.DisplayMember = "cmp2";

                        }

 Please let us know if you have any further concerns.

 

Regards,

ManiRatheenam S

 


Loader.
Live Chat Icon For mobile
Up arrow icon