开发者

Name of dropdowlist is renamed automatically?

开发者 https://www.devze.com 2023-02-02 22:56 出处:网络
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\" })%>

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="poo开发者_StackOverflow社区lgeometry">

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"

0

精彩评论

暂无评论...
验证码 换一张
取 消