Employee emp = new Employee();
comHandledBySQt.DataSource = emp.GetDataFromTable("1");
comHandledBySQt.DisplayMember = "FirstName";
The above code displays drop list of employees first names in a combo box. I want first name and last name to be displayed. How can i do it?
I tried to include two columns FirstName and LastName as below but didn’t work.
comHandledBySQt.DisplayMember = "FirstName" + " " + "LastName";
Any help will be appreciated.
If you need to do binding with the datasource straight away, you’ll need to create a custom-view for this. Or you can iterate over rows returned from emp.GetDataFromTable() and add each row to DropDown with string.Format() or some string manipulation.