2012-05-07 7 views
0

I取得ここに、次のエラー:私は私が間違っ.this午前どこから私のGetMenu方法で知らないモデルアイテムのタイプがある「System.Collections.Generic.Listエラー

 Line 45:   <tr> 
     Line 46:    <td width="15%" valign="top"> 
     Line 47:     @{Html.RenderAction("GetMenu","RoomType");} 
     Line 48:    </td> 
     Line 49:    <td valign="top" 


'The model item passed into the dictionary is of type 
'System.Collections.Generic.List`1[System.Object]', but this dictionary requires a model item of type 'System.Collections.Generic.IEnumerable`1[LicentaTest.Models.RoomType]'. 

RoomTypecontroller:

 'public ActionResult GetMenu() 
     { 
     DBContext.Current.Open(); 
     var model =RoomType.SelectAll(); 
     DBContext.Current.Close(); 
     return PartialView(model); 
     }' 

そして、ここでは私のGetメニュービューです:

 @model IEnumerable<LicentaTest.Models.RoomType> 
     @using LicentaTest.Models 
     <script type="text/javascript"> 
     $(function() { 
     $("#categories").addClass("ui-widget"); 
     $("a", "#categories").button().width(200); 
     }); 
     </script> 
     <ul id="categories"> 
     @foreach (var tipcamera in Model) 
     { 
<li>@Html.ActionLink(tipcamera.Room_Type,"Browse","RoomType",new{RoomType=tipcamera.Room_Type},null) 
     </li> 


     } 

+0

RoomType.SelectAll(の戻り値の型が何であるかを) – Shyju

答えて

0

実際に私はあなたのRoomType.SelectAll()は何をすべきか分からないが、私はそれがどのような方法が、このことは動作するはずですしてみてくださいList<object>を返すこととします

var model = RoomType.SelectAll().Cast<RoomType>(); 
関連する問題