NET Core, we follow the same pattern to implement a drop-down list menu. First, we create an Enum to use for each item included in the menu, then add a Model, and finally add a new one to the View. EnumDropDownListFor, but it turned out that an error message as shown below occurred in the View code part: The error message shows "'IHtmlHelper<dynamic>' does not contain the definition of 'EnumDropDownListFor', and no accessible extension method can be found."
It seems that EnumDropDownListFor has been removed in .Net Core. Here we find it. Another approach in Net Core: Html.GetEnumSelectList(Type enumType). The specific method is as follows. Originally in the .NET Framework, we would have an Enum and a Model, and call the business data Model in the View to use EnumDropDownListFor: In the .NET Core part, we do not need to write another Model to store the items in Enum.
We can use enum directly in the View, as shown below: Talking-about-the-drop-down-list-menu-in-.NET-Framework-and-.NET-Core Next, in the program code part, we put GetEnumSelectList(Type enumType) into < select ></ select >. The writing is as follows: The results presented are shown below: -list-menu-in-.NET-Framework-and-.NET-Core Here we find that the original default selected items are missing. Just add an <option> </option> to <select></select> and enter the text of the default option: