cshtml交替显示行数据

 

 @{

                            IList
<string> styleClassCode = new List<string>();
                            styleClassCode.Add(@sc.StyleClassCode.ToString());
                            var i
=0;
                            var length
=Mola.Admin.Web.Controllers.ProductController.GetStyleClassLangList(styleClassCode).Count;
                            
foreach (Mola.Model.GY_StyleClassLangEntity scl in Mola.Admin.Web.Controllers.ProductController.GetStyleClassLangList(styleClassCode))
                            {
                                
if (i <length )
                                {
                                    
if (i % 2 == 0)
                                    {
                                            
<tr style="background-color:#CCC">
                                                
<td width="492">@scl.Title</td>
                                                
<td width="395">@scl.Tags</td>                        
                                                
<td width="103">@scl.LangName</td>
                                                
<td width="55"><a href='EditSytleClassLang.aspx?Action=Edit&id=@scl.Id'>修改</a>
                                                
</td>
                                            
</tr>
                                    }
                                    
else
                                    {
                                            
<tr style="background-color:#DEF">
                                                
<td width="492">@scl.Title</td>
                                                
<td width="395">@scl.Tags</td>                        
                                                
<td width="103">@scl.LangName</td>
                                                
<td width="55"><a href='EditSytleClassLang.aspx?Action=Edit&id=@scl.Id'>修改</a>
                                                
</td>
                                            
</tr>
                                    }
                                    i
++;
                                }
                            }
                               
                         }

 

posted @ 2011-07-01 09:39  shizhi57  阅读(986)  评论(2编辑  收藏  举报