Controller
Kullanicilar kullanici = db.Kullanicilar.Where(f => f.Id ==
userProfileModel.UserModel.Kullanici.UserID).FirstOrDefault();
foreach (var item in db.Tanimlar.Where(f => f.TanimTipId == (int)ETanimTip.Kategoriler))
userProfileModel.AvaliableCategories.Add(item: new SelectListItem()
{
Text = item.Kod,
Value = item.Id.ToString(),
Selected = item.Id == kullanici.CategoryId
});
View
@Html.DropDownListFor(f => f.CategoryId, Model.AvaliableCategories,
htmlAttributes: new { @class = "form-control", id = "AvaliableCategories" })
When i was a look at selected value, i see true but view result is false..
true value
false result
What do i now?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…