Tying the pieces (files) together

J

John Spiegel

Hi all,

I'm working with the .NET framework and Web Matrix and am having trouble
finding how to tie together the files when deriving classes. What I've got
is a TestBase.cs file that defines a class derived from page. I also have a
codebehind file that I'm referencing from an ASP.NET page. For example,
something like:

Test.aspx...
<%@ Page Language="C#" Src="Test.aspx.cs"
Inherits="Test.Welcome.WelcomePage" %>

/* Test.aspx.cs */
namespace Test.Welcome
{
using Test.HelperStuff
public class WelcomePage : LabeledPage
{
protected void Page_Load(object Src, EventArgs e)
{ /* Some code */ }
}
}

/* TestBase.cs */
namespace Test.HelperStuff
{
using System.WebForms
using System.WebForms.UI
class LabeledPage : Page
{
protected void DoSomething()
{ /* Some Other Code */ }
}
}

If I'm just building a C# app, I'd compile an exe referencing not only my
main file but any other .cs files it uses. How do I do the analogous thing
in ASP.NET?

To paraphrase a friend: "Please note: I am not as irretrievably stupid as
this post makes me appear.", but am starting to feel that way!

TIA,

John
 
W

William F. Robertson, Jr.

I don't know enought about Web Matrix.

Is Web Matrix solution driven? I mean could you add the TestBase.cs to the
solution.

Or do you have to compile it command-line style?

bill
 
J

John Spiegel

Hey Bill,

Thanks for reading! It's basically a free environment that, at least as far
as I've seen, doesn't do that much in the way of project building. To be
fair, I haven't explored it heavily.

I guess my more generic question goes outside of Web Matrix and more to how
..NET manages its applications (which I understand to essentially be the
folder the files are in, at least in the case of ASP.NET). I would think
that I could somehow reference the "base" .cs file (that defines the class I
want to use) from the file .cs file I want to use as the src in the aspx
page. For example, I can reference Test1.aspx.cs from the @Page directive
and ASP.NET will then be able to compile and use Test1.aspx.cs. If
Test1.aspx.cs needs a class in Test2.cs, how would it reference that?

Thanks,

John
 

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

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top