I have a TextBoxFor that is set to read only and it currently holds a person's last name. What I now need to do is add to it so that the person's suffix (II, III, Sr., Jr., etc) shows in the text box next to their last name. This is what I have so far with just the last name. I can't figure out how to add the suffix portion to it (m.Person.Suffix). Everything I have tried has caused an error.
<div class="control-group">
<label>Last Name</label>
<div class="controls">
@Html.TextBoxFor(m => m.Person.LastName, new { @readonly = "readonly" })
</div>
</div>
One possibility to do this, if this will always be readonly, would be adding this to your model:
Then you can just change your code in the textbox to reference m.LastNameWithSuffix directly: