2011-02-08 4 views
0

webmatix를 사용하여 드롭 다운 목록을 작성하려고합니다. 하지만 그게 나에게 오류 메시지를주는. ASP.Net 4 드롭 다운 목록

@code 

Dim items As New List(Of SelectListItem)() 
items.Add(New SelectListItem() With { _ 
    .Text = "Swimming", _ 
    .Value = "1" _ 
}) 
items.Add(New SelectListItem() With { _ 
    .Text = "Cycling", _ 
    .Value = "2", _ 
    .Selected = True _ 
}) 
items.Add(New SelectListItem() With { _ 
    .Text = "Running", _ 
    .Value = "3" _ 
}) 


End code 
<!DOCTYPE html> 
<html lang="en"> 
    <head> 
     <meta charset="utf-8" /> 
     <title></title> 
    </head> 
    <body> 
     @Html.TextBox("Name") <br/> 
     @Html.DropDownList(@items) 
    </body> 
</html> 

Compiler Error Message: BC30201: Expression expected. 

Source Error: 



Line 26:  <body> 
Line 27:   @Html.TextBox("Name") <br/> 
Line 28:   @Html.DropDownList(@items) 
Line 29:  </body> 
Line 30: </html> 

당신이 날 지점 수 있습니다 오류 메시지, 내가 잘못 여기서 뭐하는거야? 당신은 코드 블록 내에서 이미

답변

0
@Html.DropDownList(@items) 

감사 SR 그렇게

@Html.DropDownList(items) 

는 일을 충분히

+0

감사해야한다 – sfgroups