2011-04-01 10 views
0

mVC2에서이 코드를 사용 중이며 잘 작동합니다. 하지만 mvc3로 변환하면이 코드가 오류가 발생합니다. 제발 어떻게 mvC3로 변환 말해봐. 코드는 내가 @<% %>를 교체하고 그러나이 작동하지 않습니다MVC3에서 이미지를 추가 할 때 문제가 발생했습니다.

<% Html.Grid(Model.MemberPagedList).Columns(column => { 
column.For(x => x.Id).Named("Id"); 
     column.For(x => x.message).Named("Message").Action(p => 
     { %> 
     <td> some image tag here 
     </td> 
        <td style="display: none; " id =<%= p.Id%>> 
        <%= p.LogMessage %> 
       </td> 

       <% }); 
     }).RowStart((p,row) => {  
      if (row.IsAlternate) { %> 
        <tr > 
      <% } else { %> 
       <tr> 
      <% } 
    }).Sort(Model.GridSortOptions).Attributes(@class => "table-list").Render(); %> 

입니다. 난 내가 HTML을 코드 mvc3에서 <td>.....</td>

<td style="display: none;" id=<%= p.Id%>> 
    <%= p.LogMessage %> 
</td> 

을 즉, 쓰기 방법을 이해 할 수없는 오전

+0

을있는 오류 너? – tugberk

답변

1

당신은 MVCContrib 그리드에 이미지를 추가하는 사용자 정의 열을 사용할 수 있습니다

@(Html 
    .Grid<MyViewModel>(Model.MemberPagedList) 
    .Columns(column => 
    { 
     column.For(x => x.Id); 

     column.For(x => x.LogMessage); 

     column 
      .Custom(
       @<text> 
        <span>@item.LogMessage</span> 
        <img src="@Url.Action("image", new { id = item.Id })" alt="" /> 
       </text> 
      ) 
      .Named("Message"); 
    }) 
    .Sort(Model.GridSortOptions) 
    .Attributes(new Hash(@class => "table-list")) 
) 
관련 문제