public void Bind() { _initializing = true; dataComboBox.DataBindings.Clear(); dataComboBox.SelectedIndex = -1; dataComboBox.Text = ""; // I want to insert an empty item in the datasource dataComboBox.DataSource = Model.ContAccesslist.Insert(0,); <-- What would be second parameter i need to insert... dataComboBox.DisplayMember = "DataName"; dataComboBox.ValueMember = "id"; } BLL: public List<ContViewModel> ContAccesslist { get; set; } DAL: public class ContViewModel { public int Id { get; set; } public string DataName { get; set; } public string DataType { get; set; } }
var items = Model.ContAccesslist; items.Insert(0,new ContViewModel(){DataName ="", DataType="", Id =-1 } ); dataComboBox.DataSource = items; dataComboBox.DisplayMember = "DataName"; dataComboBox.ValueMember = "id";
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)