Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Razor View if statement incorrect

My last 'if' statement is rendering as text. How can i fix that?

See how the grey highlighting for the 2nd 'if' statement completes on the end of the last 'if' statement?

My Printscreenieeeee

thanks

like image 611
Valamas Avatar asked May 08 '26 14:05

Valamas


1 Answers

Razor thinks that the previous if hasn't ended yet, since you're still inside the <div>s.

You need to prefix the <div>s with @: to prevent Razor from matching the tags.

like image 149
SLaks Avatar answered May 11 '26 06:05

SLaks