4 Answers, 1 is accepted
You can set the datasource of GridViewComboBoxColumn by setting its DataSource property. Your assumption that the selected values will come from the data source which fills the whole RadGridView with data is correct. For additional information about GridViewComboBoxColumn, please refer to our online documentation.
Let me know if you have additional questions.
Nikolay
the Telerik team
In property builder I have added a ComboBox column to the list of columns which are there from my stored procedure related data source. I have another stored procedure and another data source which pulls out the list of the names of sales people for example. I want this column to show a drop down of all of the sales people and the original stored procedure for the grid has a sales person's name so I want this sales person to be the selection out of this combo box.
I have gone through every field in the Advanced section for the combo box column and don't see where to set the datasource for the column. In code also when I grab the column and try to call its functions I only see the same list which is in Advanced settings, again no Datasource to set to an existing datasource which is then tied to a stored procedure in the database. Really like to get all of this working today, thanks. I am afraid if I do the data source in code then proper selection is not made for each row of data. Again Sales person's name is returned in the stored procedure for the grid, this person needs to be selected in the big list in the combo box.
the stored procedure returns two columns, ID and FullName
Like to show the FullName in the list and again select the name which the grid has for the sales person.
GridViewComboBoxColumn SalesPeople = new GridViewComboBoxColumn();
SalesPeople.Name = "SalesPeople";
SalesPeople.HeaderText = "Sales Person";
SalesPeople.DataSource = ds_tblSalesPeople_GetListWithID;
SalesPeople.ValueMember = "ID";
SalesPeople.DisplayMember = "FullName";
SalesPeople.FieldName = "FullName";
SalesPeople.Width = 150;
GRD_Quotes.Columns.Add(SalesPeople);
Thank you for writing back.
You should have no concerns setting the DataSource of the column programmatically - this does not have anything to do with the selection of the cells in the column. The selection depends only on the values contained in the data source that is bound to RadGridView. I checked the way you are setting up the GridViewComboBoxColumn and I believe that the issue comes from there.
Simply put, the selection in the column depends on the FieldName and the ValueMember that you set.
The selection values are taken from the column referenced via the FieldName property, but these values should match the ValueMember values of the GridViewComboBoxColumn's datasource. So, let's say that
you have a datasource bound to RadGridView, and this datasource contains only the IDs of Persons. There is another datasource which contains both the IDs of the FullNames of these persons. So, if you set the FieldName to ID (assuming that this is the name of id column for the persons in the main table) and the ValueMember to ID (assuming that this is the name of id column for the persons in the persons table), the cells in GridViewComboBoxColumn will correctly display the FullName data that corresponds to the ID values.
I hope that this explanation helps. Let me know if you have additional questions.
Nikolay
the Telerik team