views:

13

answers:

2

Data is not Displaying in the Combo Box

DataTable dt = new DataTable();

dt.Columns.Add("Code");

dt.Columns.Add("Name");

dt.Rows.Add("c1", "n1");

dt.Rows.Add("c2", "n2");

myCombo.ItemsSource = ((IListSource)dt).GetList();

myCombo.DisplayMemberPath = "Code";

myCombo.SelectedValuePath = "Name";

A: 

remove this line

myCombo.ItemsSource = ((IListSource)dt).GetList();

and add below line

myCombo.ItemsSource = dt;

saurabh
A: 

instead of this line

myCombo.ItemsSource = ((IListSource)dt).GetList();

try with

myCombo.ItemsSource = dt.DefaultView;

Kishore Kumar