I render a PartialView inside my main View
View:
@model FullProductViewModel
...
@Html.Partial(\"_CommentForm\",
Your Title
property is conflicting with the @{ ViewBag.Title = "..
line of code in your view (the ViewBag
code is used by the _Layout.cshtml
file to set the global <title>
attribute for the page).
All the HtmlHelper
methods that generate form controls set the value
by checking (in order)
ModelState
ViewDataDictionary
(ViewData
or ViewBag
)In your case, nothing has been added to ModelState
. But because a value for Title
has been added to the ViewDataDictionary
, its that value which is used for the value of your textbox. The method never gets to read the actual value you have set in your model.
The only realistic option (unless you want to modify the code in the _Layout
and all views that use it) is to change the name of the property.