views:

66

answers:

1

I'm rendering a drop down list using Html.DropDownListFor() extension. The markup I get is as follows:

<select id="NationalityId" name="NationalityId"> 
  <option value=""></option>  
  <option selected="selected" value="1">Estonian</option>  
  <option value="2">Russian</option>  
  <option value="3">Ukranian</option>  
  <option value="4">Belorussian</option>  
  <option value="5">Swedish</option>  
  <option value="6">Dutch</option>  
</select>

As you can see, option with value==1 is selected. But in Firefox 3.6.3 it doesn't display as selected, empty string (first option - value == "") is displayed instead. IE7 and Chrome render the page right - the option is selected.

Does anybody know what is going on? How do I get this around?

A: 

With VS running in debug mode, I have seen that behavior in Firefox when I first load the page without a selected item, change the view code in VS to select one, and simply hit refresh in Firefox. It shows it selected in source and Firebug, but doesn't actually select it.

If you hit Enter in the address bar instead of refreshing, or load the same URL in a separate window, it seems to start respecting the select attribute.

patridge