0
나는 다음과 같은 모델을 가지고 :데이터 주석을 사용하여 드롭 다운 텍스트로 사용할 특성을 정의 하시겠습니까?
public class Bus
{
public int ID { get; set; }
[Required]
public string From { get; set; }
[Required]
public string To { get; set; }
[Required]
public string Label { get; set; }
}
내가 할 경우 :
@Html.DropDownList("BusID", null, htmlAttributes: new { @class = "form-control" })
드롭 다운 텍스트 레이블이 '에서'속성입니다.
데이터 주석을 통해 드롭 다운을 렌더링 할 때 '텍스트'로 사용할 필드를 정의하는 방법이 있는지 궁금합니다.
감사합니다.
이 질문을보십시오 : [표시된 텍스트를 선택하는 방법] (https://stackoverflow.com/questions/28063846/how-to-choose-displayed-text-on-html-dropdownlistfor) – Nikolaus
해결할 수 있었습니까? 너의 문제? – Nikolaus