I have a datatable having 3 fields out of which I need to combine the values of the 2nd and 3rd field and display in the combo box. My approach is as under
DataTable dt = new DataTable();
dt.Columns.Add("Id", typeof(int));
dt.Columns.Add("Col1", typeof(string));
dt.Columns.Add("Col2", typeof(string));
Enumerable.Range(1, 10).ToList().ForEach(i => dt.Rows.Add(i, string.Concat("Col1", i), string.Concat("Col2", i)));
comboBox1.DataSource = dt;
comboBox1.DisplayMember = string.Format("{0} : {1}","Col1","Col2");
But I am getting the output as System.Data.DataRowView…
Even I cannot change it from stored procedure level. I can however do this using entity approach by exposing some property but that will be a huge change at present. Is there any mechanism by which i can use the datatable as source and accomplish the work.
Thanks
I have done it as under