Select Tag Helper in ASP.NET Core MVC

前端 未结 6 2218
再見小時候
再見小時候 2020-11-22 04:35

I need some help with the select tag helper in ASP.NET Core.

I have a list of employees that I\'m trying to bind to a select tag helper. My employees are in a

6条回答
  •  不知归路
    2020-11-22 05:20

    You can also use IHtmlHelper.GetEnumSelectList.

        // Summary:
        //     Returns a select list for the given TEnum.
        //
        // Type parameters:
        //   TEnum:
        //     Type to generate a select list for.
        //
        // Returns:
        //     An System.Collections.Generic.IEnumerable`1 containing the select list for the
        //     given TEnum.
        //
        // Exceptions:
        //   T:System.ArgumentException:
        //     Thrown if TEnum is not an System.Enum or if it has a System.FlagsAttribute.
        IEnumerable GetEnumSelectList() where TEnum : struct;
    

提交回复
热议问题