Partial class : where is the other parts?

M

Michael

Hi,
After creating a new Web site, there is a Default.aspx and
code-behind file Default.aspx.cs.
The class in the code-behind file is declared with partial:

public partial class _Default : System.Web.UI.Page
{
.....
}

It means the code is just a part of the class definition,
but where is the other parts of the class? I cannot find them.

Thanks!
 
W

windsurfing_stew

Does this othe half of the partial class only ever reside in memory, or
is it persisted to disk? If so, where?

Stewart
 
W

windsurfing_stew

Thanks Juan,

I'm finding this problematic for upgrades. Basically when I upgrade an
existing 1.1 page and I remove all of the control declarations (which
are usually in the hidden partial class) the compiler complains that
there is no declaration of those controls.

Any ideas?

Stew
 
A

Alan Silver

Thanks Juan,
I'm finding this problematic for upgrades. Basically when I upgrade an
existing 1.1 page and I remove all of the control declarations (which
are usually in the hidden partial class) the compiler complains that
there is no declaration of those controls.

Any ideas?

Have you changed the page directive in the .aspx file? You need
something like...

<%@ Page Language="C#" CodeFile="MyClass.aspx.cs" Inherits="MyClass" %>

where MyClass is the name of the partial class. I just converted a whole
site like this. You need to change the class definition to be partial,
remove the control definitions from the class file and change the page
directive as above. That should be all you need.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top