2
Answers

cannot rename Model in dropdownlistfor

Asp.Net Hein

Asp.Net Hein

8y
351
1
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)