I found out how to add a "dummy" entry as the first "pseudo-option" in a select element here, but now I want to set certain elements to default values in the select element.
Is this something best done using javascript, or can I do it right after the dynamic population of options in the select, which is like so:
<label>From</label>
<select name="produsagefrom">
@for (int i = 1; i <= @maxMonthsBackBegin; i++)
{
<option id="selItem_@(i)" value="@i">@i</option>
}
</select>
<label>months back</label>
<label>To</label>
<select name="produsageto">
@for (int i = 1; i <= @maxMonthsBackEndNormal; i++)
{
<option id="selItem_@(i)" value="@i">@i</option>
}
</select>
<label>months back</label>
After populating the "produsagefrom" select, I want to set it to "13" and "produsageto" to "1" as default values.
Is this a job for jQuery, can I do it right there with razor, or is it possible to do it in a code-behind (C#) file?