asp.net mvc 3 - Even and odd table rows with Razor -


I am using Ranger View Engine with MVC 3 and I am also trying to create and in strange lines Different classes are a table.

So far I have received this

  @ {var odd = true; } @forch (model user in mod) {if (strange!) {& Lt; Tr id = "lot@userLot.Id" class = "even" & gt; Other & lt; Tr id = "lot@userLot.Id" class = "weird" & gt; } & Lt; Td> @ UserLot.Id & lt; / Td> & Lt; TD & gt; @ UserLot.Description & lt; / TD & gt; & Lt; TD & gt; @ UserLot.Carat & lt; / TD & gt; & Lt; Td square = "average bid" & gt; @ User Lot.AvalBid & lt; / Td> & Lt; Td square = "rank" & gt; @ UserLot.Rank & lt; / Td> & Lt; Td square = "currentbid" & gt; @ UserLot.CurrentBid & lt; / Td> & Lt; Td style = "width: 200px; height: 30px;" Class = "tdWithBidInput" & gt; & Lt; Input type = "text" style = "display: none" /> gt; & Lt; / Td> & Lt; / TR & gt; @ {Strange =! strange; }}   

This is giving me endless trouble with stupid visual engine, it is unable to figure out what the markup is and what the code is. I tried to wrap the trip that opened the tag in a text directive, but then moans about the stupid view engine finishing tr tag. If I then wrap the closing TR tag in the text instruction then the stupid view engine will be in vain that text directive has no opening tag.

Just to be clear, this

  & lt; Text & gt; & Lt; / Tr & gt; & Lt; / Text & gt;   

Returns an error that there is no matching initial tag for the text tag Lovely.

How can I write it so that the razor does not give an error?

Please do not recommend javascript solution, I have issues of razors

  @ {var odd =     

& Lt; Td square = "rank" & gt; @ UserLot.Rank & lt; / Td> & Lt; Td square = "currentbid" & gt; @ UserLot.CurrentBid & lt; / Td> & Lt; Td style = "width: 200px; height: 30px;" Class = "tdWithBidInput" & gt; & Lt; Input type = "text" style = "display: none" /> gt; & Lt; / Td> & Lt; / TR & gt; Weird =! strange; }

@ (...) is a valid and very useful statement.

Comments