Question: I would like my views to be able to specify a class for the `<body>` tag, which lies in my master page.

My first take was to do something like this: 

```
<asp:Content ContentPlaceHolderID="BodyClassContent" runat="server">
    view-item</asp:Content>

```

However, that would require this in the master page, which doesn't work:

```
<body class="<asp:ContentPlaceHolder ID="BodyClassContent" runat="server" />">

```

Any solutions to this?

Answer: 
You could also specify the body id attribute in the View which wishes to set it:

```
@{
ViewBag.Title = "Test";
ViewData["BodyID"] = "test";
Layout = "~/Views/Shared/_Layout.cshtml";}

```

This helps to decouple the view from the controller, the controller (and/or view model) does not need to know about the id attribute of the body tag.

Set the id of the body tag in the master page like so:

```
<body id="@ViewData["BodyID"]">

```
Why don't you do in your masterpage:

```
<body class="<%=ViewData["bodyClass"].toString()%>">

```

and then set ViewData["bodyClass"] in your Controller actions? That should be equivalent...