I have properties defined in my view model like so -
public string FullName
{
get { return FirstName + " " + LastName; }
set {
FirstName = FullName.Split(null)[0];
LastName = FullName.Split(null)[1];
}
}
public string FirstName { get; set; }
public string LastName { get; set; }
My Razor View has this -
<label for="FullName">Name</label>
@Html.TextBox("FullName", Model.FullName)
While I am able to set the full name and display it in the text box when the page loads, I am NOT able to retrieve the value while form is submitted.
I need to retrieve the value from this text box too when the value is changed. What am I doing wrong here?