This is a migrated thread and some comments may be shown as answers.

Dummies guide to combo boxes

4 Answers 54 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Daniel asked on 28 Jun 2016, 01:45 PM

Hi

I am having big issues (lack of knowledge) with creating combo boxes on a gridview bound to a dataset, Can someone please point me in the right direction?

My current setup of the gridview is a SQL view that fills a dataset, which is then bound to the gridview. I have a column called 'Course', which is a column generated within the view that uses the Course_ID from the main User Table to lookup the Course name from the Course Table (see attachment). I would the Course column to be a combobox, when I auto generate the columns from the dataset it creates it as a textbox currently; and for the course names (from the course table) to be the options in the drop down . I would then like the user to see the selected options after a dataset update. Is there a way of doing this?

Thank you.

4 Answers, 1 is accepted

Sort by
0
Daniel
Top achievements
Rank 1
answered on 28 Jun 2016, 01:47 PM
VB.net if possible? 
0
Hristo
Telerik team
answered on 29 Jun 2016, 09:53 AM
Hello Daniel,

Thank you for writing.

You can display the data located in your Course table by adding a GridViewComboBox column  and binding that column to the table`s adapter. Detailed information is available here: GridViewComboBox Column. Pay attention to the ValueMemeber and FieldName properties of the column as they are important for the initial binding. The FieldName  will map the initial values for the combo box column to those already available after data binding the main grid.

I am sending you an example in which I populated data from the sample Northwind database. I also added a GridViewComboBox column according to your scenario. Besides the project, I am also sending you a short video showing the result on my end.

I hope this helps. Should you have further questions please do not hesitate to write back.

Regards,
Hristo Merdjanov
Telerik
Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms. For more information check out this blog post and share your thoughts.
0
Daniel
Top achievements
Rank 1
answered on 30 Jun 2016, 08:59 AM

Thank you very much, I have managed to get it to work.

FYI for anyone else reading this, you may need to manually create your bindingsource's linked to your tables in the dataset.

0
Hristo
Telerik team
answered on 30 Jun 2016, 10:27 AM
Hi Daniel,

Thank you for writing back.

I am glad that I managed to help. 

Please let me know if you need further assistance.

Regards,
Hristo Merdjanov
Telerik
Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms. For more information check out this blog post and share your thoughts.
Tags
GridView
Asked by
Daniel
Top achievements
Rank 1
Answers by
Daniel
Top achievements
Rank 1
Hristo
Telerik team
Share this question
or