Check this out. I have a file called _template.aspx that I use for all my
applications.
On the aspx side, here's the Page directive:
<%@ Page language="c#" Codebehind="_template.aspx.cs"
AutoEventWireup="false" Inherits="MyNamespace.__template" %>
On the C# side:
namespace MyNamespace
{
public class __template : System.Web.UI.Page
{
So here's what I do. I select _template.aspx in my Solution Explorer, do
Ctrl-C, then Ctrl-V. Now I have a webform called Copy of _template.aspx.
I rename it to SomeWebForm.aspx. Now my Page Directive is:
<%@ Page language="c#" Codebehind="SomeWebForm.aspx.cs"
AutoEventWireup="false" Inherits="MyNamespace.__template" %>
And I go into my codebehind, and change the class definition from:
On the C# side:
namespace MyNamespace
{
public class __template : System.Web.UI.Page
{
to
On the C# side:
namespace MyNamespace
{
public class SomeWebForm : System.Web.UI.Page
{
what happens is that the IDE automatically changes my Page Directive to:
<%@ Page language="c#" Codebehind="SomeWebForm.aspx.cs"
AutoEventWireup="false" Inherits="MyNamespace.SomeWebForm" %>
This might seem a little clumsy, but it takes me two seconds to do...