Partial classes

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi Everyone,

we're currently developing an web-app for insurance company. We've got a
long form-flows and view-classes (MVC) of about 2000 lines of code. Is there
any possibility to split code-behind classes into multiple files using
partial classes? It would be helpfull to balance work on multiple developers
working on same subject.
I've already got it done in DLL-Projects (SQL-Helper, Builders, .... ) but
how to do it in web-projects?

Thanks for help!


Sebastian
 
I try to compile a web projects with one aspx file and multiple code-behind
classes. In page-directive you can use only ONE class (file, inherits, ...).
There is no more web-proj. file in VS 2005 if you're using the new model (not
this known from VS 2003).

If I'm putting events for buttons in separate (partial) class, I get an
error that compiler couldn't find the signatures (so it doesn't put together
the partial classes by compiling the projects).

My Example (should describe the prob better), my files:

- somePage.aspx (<%@ Page AutoEventWireup="true" CodeFile="somePage.aspx.cs"
Inherits="SomePage" Language="C#" %>)

- somePage.aspx.cs (public partial class SomePage)
- somePageButtonEvents.aspx.cs (public partial class SomePage)
- somePageHelpers.aspx.cs (public partial class SomePage)

somePageButtonEvents.aspx.cs - contains events for buttons/radios, a so on,
on the page
somePageHelpers.aspx.cs - contains methods and events for ex. filling
dropdowns a so on.

By compiling the app I get an error "Couldn't find events for buttons,
drop-downs, ..."

Has anyone an example for such scenario?

Sebastian


Eliyahu Goldin said:
In the same way as you do it for the dlls.

An example:
public partial class MasterGrid : System.Web.UI.MasterPage

{

....

}


--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]


Sebastian said:
Hi Everyone,

we're currently developing an web-app for insurance company. We've got a
long form-flows and view-classes (MVC) of about 2000 lines of code. Is
there
any possibility to split code-behind classes into multiple files using
partial classes? It would be helpfull to balance work on multiple
developers
working on same subject.
I've already got it done in DLL-Projects (SQL-Helper, Builders, .... ) but
how to do it in web-projects?

Thanks for help!


Sebastian
 
In the same way as you do it for the dlls.

An example:
public partial class MasterGrid : System.Web.UI.MasterPage

{

....

}
 
Back
Top