級聯

2013-08-26 35 views
-1

我有一個cshtml問題:我有這樣的片段:級聯

@for (int i = 0; i < 25; i++) 
       { 
       <tr> 
       <td> 
         <input class="myCell" type="text" name ="num"@i/> 
       </td> 
       <td> 
        <input class="myCell" type="text" name="client"@i/> 
       </td> 
       <td> 
        <input class="myCell" type="date" name ="reception"@i/> 
       </td> 
       <td> 
        <input class="myCell" type="date" name="cloture"@i/> 
       </td> 
      </tr> 
       } 

,我想重新命名的第一個輸入num0client0 .....直到最後輸入num23client23 ...,我嘗試上面的代碼片段,但沒有奏效。

爲什麼代碼不起作用?我該如何解決它?

+1

** **是如何工作的?發生了什麼? – SLaks

+0

閱讀生成的來源。 – SLaks

+1

name =「cloture @(i)」 – phillip

回答

2

這聽起來像你想寫

name="[email protected](i)" 

括號是必要的,以防止剃刀從想這是一個電子郵件地址並忽略它。

2

嘗試把變量的雙引號中,並把它放在括號:

<input class="myCell" type="text" name ="[email protected](i)"/> 
<input class="myCell" type="text" name="[email protected](i)"/> 
...