List in Sitefinity

Apr 13


Sitefinity has a few hidden gems and helpful utilities which are very handy to know about. It would be nice if they had a page listing these out. Recently I needed a list of countries. I knew the eCommerce module dealt with such a list so where was it? I went looking and found not only the list but a little bit extra.

One good thing about country details is they don't change often, so its safe to hard code these into your project as opposed to looking up a data source. Sitefinity has also done this and added a lot of helpful related data. You can find it in the LocationRetriever.

LocationRetriever locationRetriever = new LocationRetriever();

In this class you have several methods.

  • GetCountries() - Get all the countries
  • GetCountry(countryIsoCode) - Get a particular country
  • GetStatesAndProvincies(countryIsoCode) - Gets the states or provinces for a country. (US and CA)

A country has several properties.

  • Name
  • IsoCode
  • Latitude & Longitude
  • Currency name
  • Currency ISO code
  • Currency ISO numeric code
  • States and Provinces of that country

Some helpful stuff if you need country information.

Darrin Robertson - Sitefinity Developer

Thanks for reading and feel free to comment - Darrin Robertson

If I was really helpful and you would buy me a coffee if you could, yay! You can.

Leave a comment
Load more comments

Make a Comment

recapcha code