Not showing Selected Value in Lambda Expression in View Page
<p>I have a controller with a action </p>

<pre><code>public ActionResult ActionName(int ID)
{
   ViewBag.StudentID = new SelectList(Student, "StudentID", "StudentName", ID);
   return View()
}
</code></pre>

<p>In the view</p>

<pre><code>@Html.DropDownListFor(m =&gt; m.StudentID, ViewBag.StudentID as SelectList, "Select Student", new{ @class = ".."})
</code></pre>

<p>This field is a required field, the razor is not rendering with the selected value and the require field is working <br>But when i use </p>

<pre><code>@Html.DropDownList("StudentID", null, "Select Student", new{ @class = ".."})
</code></pre>

<p>The razor renders the selected Value, that require is not working in the above code</p>