2014-12-28 2 views
0

나는과 같이 참조하고이이러한 개체에 대해 드롭 다운 목록을 어떻게 사용합니까?

public virtual List<Administrator> AuthorizedAdministrators { get; set; } 
public int SelectedAuthorizedAdministrators { get; set; } 

처럼 보이는 물체에서 드롭 다운을 참조하려고 :

@Html.DropDownListFor(model => model.SelectedAuthorizedAdministrators, new 
SelectList(Model.AuthorizedAdministrators.Select(x => new { Value = x.Id, Text = x.Username }), 
"Value", "Text"), Model.SelectedAuthorizedAdministrators) 

내가 오류가 어떻게

c:\STI\Portals\STI.Network.Web\Views\FinancialInstitutions\Create.cshtml(102): error CS0012: 
The type 'System.Collections.Generic.List`1<T0>' is defined in an assembly that is not 
referenced. You must add a reference to assembly 'System.Collections, 
Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. 

입니다 나는이 오류를 해결합니까? 내 모델에서이 모델을 올바르게 참조하고 있습니까?

+1

당신이 System.Collections''에 대한 참조를 추가하려고 했습니까? ;) – khlr

답변

0

다음과 같이 시도하십시오. 도움이 될 수 있습니다.

은 다음과 같은 코드 드롭 다운을 변경해주십시오 간단

@Html.DropDownListFor(m => m.SelectedAuthorizedAdministrators, new SelectList(Model.AuthorizedAdministrators, "Id", "Username ")) 
+0

이 코드가 도움이된다면, 눈금을 클릭하십시오. 그러면 다른 사람들이 검색 중에 답변을 찾을 수 있습니다. – Aravindan

관련 문제