2016-05-31 48 views
-1

我如何管理我的下拉列表禁用/ readOnly的 这是我的代码:Html.Dropdownlist禁用/只读

foreach (var item in Model.TranscriptData.Transcript.Where(s => s.TermNo == termItem && s.InsteadOfLessonNo == null).ToList()) 
{ 
    @Html.DropDownList("LetterGradeValue", new SelectList(grade, "Value", "LetterGrade", string.Format("{0};{1};{2}", coefficient, letterGradeTypeId, letterGrade)), "-", new { @onchange = "ChangeValues(" + counter + ");", @class = counter }) 
} 
+0

新{@class =“form-control”,@ disabled =“disabled”}) –

+0

它不起作用。 –

+0

然后问题是其他地方 –

回答

0

试试这个。

@Html.DropDownList("LetterGradeValue", new SelectList(grade, "Value", "LetterGrade", string.Format("{0};{1};{2}", coefficient, letterGradeTypeId, letterGrade)), "-", new { @onchange = "ChangeValues(" + counter + ")",@disabled = "disabled", @class = counter }) 
+0

这是工作谢谢 –

+0

@OsmanYalçın欢迎您。 –