第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

在ASP.NETCoreMVC中選擇Tag Helper

在ASP.NETCoreMVC中選擇Tag Helper

C#
德瑪西亞99 2019-07-01 20:33:01
在ASP.NETCoreMVC中選擇Tag Helper在ASP.NETCore中的SELECT標記助手方面,我需要一些幫助。我有一個員工列表,我正試圖綁定到一個選擇標記助手。我的員工List<Employee> EmployeesList所選擇的值將進入EmployeeId財產(chǎn)。我的視圖模型如下所示:public class MyViewModel {    public int EmployeeId { get; set; }    public string Comments { get; set; }    public List<Employee> EmployeesList {get; set; } }我的雇員班如下所示:public class Employee {    public int Id { get; set; }    public string FullName { get; set; } }我的問題是如何告訴選擇標記助手使用Id作為顯示時的值FullName在下拉列表里?<select asp-for="EmployeeId" asp-items="???" />我希望能幫上忙。謝謝。
查看完整描述

3 回答

?
aluckdog

TA貢獻1847條經(jīng)驗 獲得超7個贊

您也可以使用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<SelectListItem> GetEnumSelectList<TEnum>() where TEnum : struct;


查看完整回答
反對 回復 2019-07-01
  • 3 回答
  • 0 關(guān)注
  • 986 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號