Name of dropdowlist is renamed automatically????

Posted by Akawan on Stack Overflow See other posts from Stack Overflow or by Akawan
Published on 2011-01-04T09:41:13Z Indexed on 2011/01/04 9:53 UTC
Read the original article Hit count: 213

Filed under:
|

Hello,

I've a problem with DropDownlist Name in ASP.NET MVC

In my EditorTemplate, I've

  <%: Html.DropDownList("PoolGeometry",Model.selectVm.PoolGeometry, new { id = "poolgeometry" })%>

In generate html, I've

<select name="Pool.PoolGeometry" id="poolgeometry">

Normally, "PoolGeometry" is a field in db. If my dropdownlistname has the same name, selected value is value of field.

I don't understand this automatic rename!

EDIT :

Name is dependent on EditorTemplate :

if EditorTemplate called like this:

<%: Html.EditorFor(model => model.Pool,"SwimmingPool","")%>

Name of dropdownlist is "PoolGeometry" and selectedvalues are ok.

But if it is called like this:

<%: Html.EditorFor(model => model.Pool,"SwimmingPool")%>

Name of dropdownlist is "Pool.PoolGeometry"

© Stack Overflow or respective owner

Related posts about asp.net-mvc-2

Related posts about dropdownlist