<p>I have this html...</p>

<pre><code>&lt;select id="View" name="View"&gt;
   &lt;option value="1"&gt;With issue covers&lt;/option&gt;
   &lt;option value="0"&gt;No issue covers&lt;/option&gt;
 &lt;/select&gt;
</code></pre>

<p>It won't let me insert code like this...</p>

<pre><code>&lt;select id="View" name="View"&gt;
   &lt;option value="1" &lt;% ..logic code..%&gt; &gt;With issue covers&lt;/option&gt;
   &lt;option value="0" &lt;% ..logic code..%&gt; &gt;No issue covers&lt;/option&gt;
 &lt;/select&gt;
</code></pre>

<p>So whats the best way to set one to selected?</p>

<p>Update:
Without using the HTML Helpers.</p>

The "best" approach is probably to
use
the helpers:
```
```
var selectList = new SelectList(data, "ValueProp", "TextProp", data[1].ValueProp);
... Html.DropDownList("foo", selectList)
```
```
Where "data" could be an array of anonymous types, such as:
```
```
var data = new[] {
  new {Key=1, Text="With issue covers"},
  new {Key=0, Text="No issue covers"}
};
// todo: pick the selected index or value based on your logic
var selectList = new SelectList(data, "Key", "Text", data[1].Key);
Writer.Write(Html.DropDownList("foo", selectList));
```
```
Another approach might be to select the correct item client-side through script, but obviously that only works with script enabled.
Note it was missing comma and semicolon in data declaration, stopped it from working