0

I have a drop down column and the drop down contain a value "accidents" .Now I want to make the value to read as upper case "Accidents" and there are many as such in the grid .One way is to update the current value to uppercase but as these values are being used in the application where they want the wording to be in the lower case .How can these be handled through code..please advise?

user1567194
  • 179
  • 2
  • 3
  • 17
  • If I'm reading correctly you don't want to make the change to the data source, just to the dropdown? [This question](http://stackoverflow.com/questions/3474254/how-to-make-a-first-letter-capital-in-c-sharp) shows you how to capitalize the first letter of a string, after binding your dropdown you could loop through the items and apply the changes with the example function. – Goose Oct 26 '12 at 23:30

2 Answers2

2

Give your dropdownlist a CSS class (let's say 'my-ddl') and add this to your CSS file.

.my-ddl { text-transform: capitalize; }
Razvan Trifan
  • 534
  • 2
  • 6
1

Do it from your datasource and that will depend on what kind of datasource you have

   List<X> newList = new List<X>();
   foreach(var item in origList)
   {
      newList.Add(new X {value = item.Value, 
                         text = Capitalize(item.Value)
                        });
   }

   dropdownlist.DataSource = newList;
codingbiz
  • 26,179
  • 8
  • 59
  • 96