MVC Razor for loop

后端 未结 6 1313
小鲜肉
小鲜肉 2021-02-13 10:16

I have this code (nested inside a form post) but am continually getting the error that it\'s missing the closing }

@for(int i=0;i< itemsCount         


        
6条回答
  •  囚心锁ツ
    2021-02-13 11:22

    Try put @: before your html code like this:

     @for(int i=0;i< itemsCount; i++)
     {
        @: html code here
     } 
    

    Alternatives: 1. wrap your html code with 2. use HtmlHelper to generate the html code

提交回复
热议问题