Answer the question
In order to leave comments, you need to log in
Why isn't the field value updated?
There is a Profile model, which I pass to the View and edit there
public class Profile
{
public int Id { get; set; }
public int UserId { get; set; }
public virtual User User { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public int Age { get; set; }
public DateTime LastUpdateDate { get; set; }
public string Avatar { get; set; }
}
@using(Html.BeginForm("EditProfile","Profile"))
{
@Html.LabelFor(m => m.Age)
@Html.EditorFor(m => m.Age)
@Html.LabelFor(m => m.Avatar)
@Html.EditorFor(m => m.Avatar)
@Html.LabelFor(m => m.FirstName)
@Html.EditorFor(m => m.FirstName)
@Html.LabelFor(m => m.LastName)
@Html.EditorFor(m => m.LastName)
@Html.HiddenFor(m=>m.Id)
@Html.HiddenFor(m => m.LastUpdateDate,new { value=DateTime.Now})
@Html.HiddenFor(m => m.UserId)
<input type="submit" value="Сохранить">
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question