ASP.NET - How do I maintain a selection in my MVC 5 view's dropdownlist after a postback?

Asked By MARKAND BHATT on 20-Feb-14 09:29 AM
I have 2 dropdownlists of month and year. here is the razor code.

01.@using (Html.BeginForm("Index", "Expense", FormMethod.Get))
02.{
03.  <p>
04.    Month <select name="drpMonth">
05.      @for (var i = 1; i <= 12; i++)
06.      {
07. 
08.        <option>@i</option>
09.      }
10.    </select>
11.    Year <select name="drpYear">
12.      @for (var i = -3; i <= 3; i++)
13.      {
14.        <option>@(DateTime.Now.AddYears(i).Year)</option>
15.      }
16.    </select>
17.    <input type="submit" value="Filter" />
18. 
19.  </p>
20.}

when i click on "Filter" button, a postback occurs and the selected value of the dropdownlists
How do I maintain a selection in my MVC 5 view's dropdownlist after a postback?