I am using DataBinding to load a DropDownList with data from SQL Server 2000 Database, using a SqlDataReader. It works fine and looks something like this:
sqlComm.CommandText = "Select * from Country";
//dr = new SqlDataReader();
dr = sqlComm.ExecuteReader();
ddlCountry.DataSource = dr;
ddlCountry.DataTextField = "CountryName";
ddlCountry.DataValueField = "CountryCD";
As we can see, the Drop down would finally show only the CountryName content. But I want it to show "<CountryName> - <CountryCD>". So instead of "United States", it should show "United State - USA". How should I do that?
Can I use databinding here or should I have to traverse through each entry in the DataReader and assign the values?