<% string userName = string.Empty; if (Model != null) { userName = Model.Name; } %> <input asp-for="Name" value="@userName" class="form-control" />