tags:

views:

134

answers:

2

I need to convert a select list (which is populated by a data feed) into lower case, I have traced as far some code in the relevant controller;

private SelectList getAddressCountriesListDD()
{
    var addressCountries = myOPG.AddressCountries;
    return new SelectList(addressCountries, "key", "value", "GBR");
}

The myopg part is the datafeed, I need to get the selectlist into lowercase.

How can I accomplish this?

A: 

if addressCountries is a list of strings, then something like this (using LINQ).....

var lcase = from c in addressCountries
select c.ToLower();
Muad'Dib
+4  A: 

Replace

var addressCountries = myOPG.AddressCountries;

with

var addressCountries = myOPG.AddressCountries
                            .Select(c => c.ToString().ToLowerInvariant());
Jason