Pages Not Inheriting Admin Theme

Topics: General, Writing modules
Feb 11, 2012 at 5:08 AM

Hi everyone,

Can someone tell me what the rules are for getting views into the admin theme?
If I create a controller called AdminController with an Index action that returns a very basic view, it works, once routed I see the new view in the normal admin theme.

If I create another controller FooAdminController with Index action, create the same basic view, route it and this view shows up under the main site theme, not admin.

The url is -- this should have the admin theme applied.
For the moment, the view is simply a <div>Hello</div>.

The controller, and action both have the Themed attribute. What am I missing?

I know this is possible, I'm looking at how the Blog module does it but I'm not seeing where the magic is happening.


Feb 11, 2012 at 5:12 AM

It's a convention - anything called "AdminController" will automatically get the admin theme.

Otherwise, you can use the [Admin] attribute to trigger the theme on other controllers or actions.

Feb 11, 2012 at 5:19 AM

D'oh, I was looking right at it and missed it:
[ValidateInput(false), Admin]
I saw the "ValidateInput" and just ignored the rest, not realizing there were two attributes there.

Thanks Pete!