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

Bind visible column ComboBox to DataTable

Thread ID:





99845 Jun 15,2011 01:44 PM UTC Jun 22,2011 07:25 PM UTC WPF 1
Tags: GridControl
Administrator [Syncfusion]
Asked On June 15, 2011 01:44 PM UTC


In my GridDataControl I have a combobox type column which I would like to bind to a datatable.

I've tried this with no success:

var _eventTypes = from g in GlobalData.db.EventTypes select new { g.EventTypeID, g.EventTypeDesc };
DataTable dtEvents = new DataTable();
DataColumn column; DataColumn column2;
column = new DataColumn(); column2 = new DataColumn();

column.ColumnName = "EventTypeID";
column2.ColumnName ="EventTypeDesc";
column2.DataType = System.Type.GetType("System.String");
column.DataType = System.Type.GetType("System.Int32");

foreach (var o in _eventTypes)
// dicEventType.Add(o.EventTypeDesc, o.EventTypeID);
DataRow row = dtEvents.NewRow();
row[0] = int.Parse(o.EventTypeID.ToString());
row[1] = o.EventTypeDesc;

int test = dtEvents.Rows.Count;

this.grdEventsUpload.VisibleColumns["EventType"].ColumnStyle.ItemsSource = dtEvents;
this.grdEventsUpload.VisibleColumns["EventType"].ColumnStyle.ValueMember = "EventTypeID";
this.grdEventsUpload.VisibleColumns["EventType"].ColumnStyle.DisplayMember = "EventTypeDesc";

I'm not getting any errors but the combobox items list is empty.


Deenadhayalan M [Syncfusion]
Replied On June 22, 2011 07:25 PM UTC

Hi Assaf,

Thanks for your interest in Syncfusion products.

We have prepared a sample based on your code snippet and achieved your requirement. Please find the sample under the following location.

Please let us know if this sample helps.




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