I have a table with repeating customer rows, I would like to add the customer ID to the ID attribute of my table rows like this:
        
                      
      
      
      
        
        
                         				            - 
            
           
            
            
                                                                       
have you tried <tr>row@(c.id)</tr>?
The actual reason why this doesn't work is because your row@c.id matches the regex for an email address. So the parser assumes it's an email and not actually an attempt to call code. The reason row@{c.id} doesn't work is because the @{} doesn't output and is meant to contain blocks of code.
When in doubt you should use @() as it will force what's contained between the () to be parsed as code.
                                                                        
                                                        
            
            
              
                 
                
               讨论(0)
              
              
                                                   
              
                                                            
            
                      
           
          	          
                             
        
        
          
        
      
       
      
    
    
          
 
     
 
        - 热议问题