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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

adding an object to combobox in grid

Thread ID:





29422 May 25,2005 12:24 PM UTC May 26,2005 09:42 AM UTC WinForms 3
Tags: GridControl
Catinat Velmourougan
Asked On May 25, 2005 12:24 PM UTC

hi if you take a combobox cb, cb.Items.Add() function allows one to add an object. I have a combobox embedded on a cell on a grid. Is it possible to add an object to the combobox on the grid. I was able to add a list of strings as follows StringCollection strcol = new StringCollection(); strcol.Add("a"); strcol.Add("b"); this.grid1.ColStyles[2].ChoiceList = strcol; But strcol.Add() doesnt take an object as parameter. So how can we associate an item in combo on the grid to an object?

Administrator [Syncfusion]
Replied On May 25, 2005 12:44 PM UTC

If you want to display something other than strings in a combobox in a grid cell, then you will need to set that cell to use a DataSource, DisplayMember, ValueMember. Take a look at the \Syncfusion\Essential Studio\\Windows\Grid.Windows\Samples\CellTypes\ComboboxCells sample. It uses DataTables for the most part, but you can use any IList object as teh DataSource. One convention is that is you set the ValueMember = null, then grid will actually store the objectt from the IList as teh cell value.

Catinat Velmourougan
Replied On May 26, 2005 08:40 AM UTC

Hi , Consider the following code sample : this.grd.ColStyles[1].BaseStyle = "Heading 1"; this.grd.ColStyles[1].DataSource = this.ColumnSelectView.Items; this.grd.ColStyles[1].DisplayMember = "Text"; I have set the datasource of colstyle to a collection of ListViewItems. I had set the displaymember to text property of the listviewitem. I had set the valuemember to null. But the cell type is combobox. when i select an item on the combobox it displays as shown in image2. I dont want the "ListViewItem:{" to appear in "ListViewItem:{Sedol}".It should be "Sedol". How to do it? image_2_7467.zip

Administrator [Syncfusion]
Replied On May 26, 2005 09:42 AM UTC

Text is a public property for the objects in your list, correct? Case matters. Here is a sample that seems to work as expected in http://www.syncfusion.com/Support/user/uploads/GC_ComboArrayList_71f44b6a.zip Does it work for you? If you cannot spot the problem, can you post a sample that show this problem?


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon