1

I have DropDownListFor in MVC view, with this line:

  @Html.DropDownListFor(m => m.UserOffice, Enumerable.Empty<SelectListItem>(), new { @class = "form-control", data_ng_model = "OfficeID", data_ng_options = "I.Id as I.Name  for I in OfficeList", @id = "UserOffice" })

I need to store in "m.UserOffice" the "data_ng_model" value instead Selected index.

how can I do it ?

Eliad
  • 140
  • 1
  • 11
  • `m` is the model coming from the controller. What are you wanting to do with this value after you have set it? – Luke Jul 21 '15 at 09:15
  • i need to store the ng-model value inside. for example: if SelectedIndex is "2", i want to store in m.UserOffice the value "213". – Eliad Jul 21 '15 at 09:24
  • can someone give a hint maybe ? – Eliad Jul 21 '15 at 10:20
  • Where do you want to store it? You should be posting the chosen value back to your controller for processing. – Luke Jul 21 '15 at 10:22
  • also, if there is an option , how can i send the ng-model value to the controller ? this is the html post: @using (Html.BeginForm("AddUser", "AdminUsers")) – Eliad Jul 21 '15 at 11:54
  • You'd probably have to send that value over javascript – Luke Jul 21 '15 at 12:12

0 Answers0