Home  • Programming • ASP.NET Core

Example of Dictionary class in ASP.NET Core

select-name-cmbcountry
<select name="cmbCountry" >
@{
Dictionary<String, String> countries = new Dictionary<String, String>();
countries.Add("Australia", "AU");
countries.Add("Canada", "CN");
countries.Add("Bangladesh", "BN");
countries.Add("India", "IN");
countries.Add("Maldives", "MV");
countries.Add("Pakistan", "PK");
countries.Add("USA", "US");
countries.Add("United Kingdom", "UK");

 foreach (var country in countries)
 {
  <option value="@country.Value">@country.Key</option>           
 }

}
</select>

Comments 0


Copyright © 2025. Powered by Intellect Software Ltd