Asp.Net Hein

Asp.Net Hein

  • NA
  • 266
  • 167.3k

cannot rename Model in dropdownlistfor

Jun 3 2016 3:05 AM
I want to add Dropdownlist in my MVC application but I have an error. 
 
 CS0135: 'Model' conflicts with the declaration 'System.Web.Mvc.WebViewPage<TModel>.Model'
 
This is my razor code for dropdownlist
 
@Html.DropDownListFor(a => a.UserId, new SelectList(Model.UserItems, "Id", "UserName"));
 
*Most of the reference said I cannot use Model in select list. But I cannot rename to others. Kindly support if you have any ways. 

Answers (2)