I have 2 TextBoxFor:
@Html.TextBoxFor(model => model.Name) //Name
@Html.TextBoxFor(model => model.Surname) //Surname
I want to combine these two textboxfor values in 1 textbox:
@Html.TextBox(... or //Name surname
input type="text" ...
Thanks.
Create property in your model named as FullName
public string FullName
{
get
{
return String.Format(Name + " " + Surname);
}
}
And then use FullName in TextBoxFor helper,
@Html.TextBoxFor(model => model.FullName)