Use of C# Razor Syntax in MVC.net view
I would argue that the code in the top should not be moved to Controller.

This of course depends on how you define responsibilities for View, Controller and Model, but I would leave the code in the View because Controller and Model should not have knowledge about CSS if it can be avoided.

More about responsibilities in ASP.NET MVC