views:

120

answers:

1

What it's the easiest way to change the css class name of a WebContentForm that use a MasterPage ?

Example:

  • MasterPage : <body>...</body>
  • Index.aspx : I will like the rendered page to look like <body class="myClass">...</body>
  • Other.aspx : <body>...</body>
A: 

I use this workaround :

On MasterPage : <body id="body" runat="server">

On Index.cs : ((HtmlGenericControl)Page.Master.FindControl("body")).Attributes["class"] = "myClass";

It's not really elegant, but it's work

Melursus