I am not able to write expression in TextboxFor()
method in VS 2013. Below is the razor code for Textbox in asp.net mvc.
@Html.TextBoxFor(m => m.User.LicenseNo)
which is showing an error in VS 2013 :
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
But when I open the same solution in VS 2017 its working fine.
The same is the case with the following code
ViewBag.Title = "Role Configuration";
Error in VS 2013:
One or more types required to compile a dynamic expression cannot be found. Are you missing a reference?
EDIT
Below is my Model UserDetailsModel
used in the view.
public class UserDetailsModel
{
public UserDetailsModel();
public List<RoleModel> Roles { get; set; }
public List<CodeItemModel> 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; }
}
And I have placed the below code at the top of the view (.cshtml file)...
@{
ViewBag.Title = "Role Configuration";
}