title: The type arguments for method cannot be inferred from the usage. view Bag and html helper error
body: <p>I am not able to write expression in <code>TextboxFor()</code> method in VS 2013. Below is the razor code for Textbox in asp.net mvc.</p>
  
  <pre><code>@Html.TextBoxFor(m =&gt; m.User.LicenseNo)
  </code></pre>
  
  <p>which is showing an error in VS 2013 : </p>
  
  <blockquote>
    <p>The type arguments for method 'System.Web.Mvc.Html.InputExtensions.TextBoxFor(System.Web.Mvc.HtmlHelper, System.Linq.Expressions.Expression>, System.Collections.Generic.IDictionary)' cannot be inferred from the usage. Try specifying the type arguments explicitly</p>
  </blockquote>
  
  <p>But when I open the same solution in VS 2017 its working fine.</p>
  
  <p>The same is the case with the following code</p>
  
  <pre><code>ViewBag.Title = "Role Configuration";
  </code></pre>
  
  <p>Error in VS 2013:</p>
  
  <blockquote>
    <p>One or more types required to compile a dynamic expression cannot be found. Are you missing a reference?</p>
  </blockquote>
  
  <p><strong>EDIT</strong></p>
  
  <p>Below is my Model <code>UserDetailsModel</code> used in the view.</p>
  
  <pre><code>public class UserDetailsModel
  {
      public UserDetailsModel();
  
      public List&lt;RoleModel&gt; Roles { get; set; }
      public List&lt;CodeItemModel&gt; Status { get; set; }
      public UserModel User { get; set; }
  }
  public class UserModel
  {
      public UserModel();
  
      public string Email { get; set; }
      public string FirstName { get; set; }
      public int Id { get; set; }
      public string LastName { get; set; }
      public int LicenseNo { get; set; }
  }
  </code></pre>
  
  <p>And I have placed the below code at the top of the view (.cshtml file)...</p>
  
  <pre><code>@{
      ViewBag.Title = "Role Configuration";
  }
  </code></pre>