0

I am new to ASP .Net Web Application MVC (.Net Framework Visual Basic) and having issue creating a hardcoded drop down list.

Have searched multiple sources but still unable to solve my problem.

From what I know, Create/Edit.vbhtml is the form to modify field from textbox to drop down list. And I have not changed anything on my Controller.vb that has been generated automatically when creating this project.

Below is the original code of mine:

@Html.EditorFor(Function(model) model.Product, New With { .htmlAttributes = New With { .class = "form-control" } })
Marco Bonelli
  • 63,369
  • 21
  • 118
  • 128
Stacie T.
  • 420
  • 6
  • 17
  • As the documentation states, the `EditorFor` method renders an `input` element. The `DropDownListFor` method renders a `select` element. Presumably you want the latter. – John Jul 17 '22 at 06:42
  • @John I still couldn't solve it by changing EditorFor to DropDownListFor. How to set all the value for ? – Stacie T. Jul 17 '22 at 10:20
  • Does [How to write a simple Html.DropDownListFor()?](https://stackoverflow.com/questions/3057873/how-to-write-a-simple-html-dropdownlistfor) help? – Andrew Morton Jul 17 '22 at 12:00
  • You should edit the question and show us the new code. – John Jul 17 '22 at 12:42
  • Why did you specify Hard Coded drop down list but I saw in your code you have a Model which is supposed to be not hard coded. Do you want a sample code in Visual Basic to implement a DropDownList? Kindly be specific in the question :) – Jkyle Landicho Jul 19 '22 at 03:15

0 Answers0