ASP.NET MVC 2 points replaced by the subscript in the element name (although ASP.NET MVC will put the default points in the name attribute!)
When you insert an element in a form in ASP.NET MVC, it usually does the following:
<%= Html.TextBoxFor(model => model.Contact.FirstName)%>
becomes
<input type="text" name="Contact.FirstName" id="Contact_FirstName" ...
This is good and good. However, if you want to do this:
<%= Html.DropDownList(
"Contact_Title",
new SelectList(Model.Titles, "Key", "Value"))%>
In fact, you end up with
<select id="Contact_Title" name="Contact_Title">...
Note that you now have an underscore, not a period in the name attribute.
So, I thought I was passing the name, including the dot, for example:
<%= Html.DropDownList(
"Contact_Title",
new SelectList(Model.Titles, "Key", "Value"),
new { name = "Contact\\.Title" })%>
But it still displays as:
<select id="Contact_Title" name="Contact_Title">...
I really (really) want this to display as:
<select id="Contact_Title" name="Contact.Title">...
To make it automatically bound to Model.Contact.Title - any ideas?
IMPORTANT UPDATE
... , , name ...
new { name = "MYNAME" }
- Contact_Title!
!