AjaxDropDown Parent property inside EditorTemplate

Hello, How could I set the "parent" property in a AjaxDropDown for correctly identifying her father in a EditorTemplate? In a view of creating a vehicle I have the following form
@using ( Html.BeginForm ("Create", "Vehicles" ) )
{
  @Html.EditorFor (= > m.VehicleEditor )
}
Inside VehicleEditor.cshtml I have two AjaxDropDown
 1. @ ( Html.Awe (). AjaxDropdownFor (= > m.MakeId )
 2. @ ( Html.Awe (). AjaxDropdownFor (= > m.ModelId .) Parent (= > m.MakeId )
The Id (1) is VehicleEditor.MakeId , however the "Parent " property set is simply " makeId " thus rendering the javascript is: " ... data : {" keys " : [ " parent "]," waltz " : [" MakeId "] } ... " and should be " ... data : {" keys " : [ " parent "]," waltz " : [" VehicleEditor_MakeId "] } ... " To fix it I have the following option, but consider it a bad practice because any change in location or model would force me to change the view :  @ ( Html.Awe (). AjaxDropdownFor (m = > m.ModelId .) Parent ( " VehicleEditor.MakeId " ) The same thing happens if the parent adds the " Sufix " property. It is possible to do different? thanks
owner
Albert
asked at 20 Mar 2014
  • could you please isolate this in a small solution (using trial version) upload it somewhere and post here the link
    at 20 Mar 2014 Omu
  • at 20 Mar 2014 Albert
  • please see my edited answer
    at 21 Mar 2014 Omu

Answers 

please Sign In to leave an answer

By accessing this site, you agree to store cookies on your device and disclose information in accordance with our cookie policy and privacy policy .
contact us