Custom Page and User Control base Classes in MVC

Justin Grant’s solution to this was really appreciated.

I’ve just been having a bit of an issue with User Controls though. and found out that the Inherits attribute on page and control are not needed. When I inherited from the class on a page I was fine, but Inheriting from the User Control class gave me errors.

So the following will work and give you code completion…

For Pages:

<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" %>

For Controls:

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Example.ascx.cs" %>


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: