Multiple Partial class file in aspx code behind file?

Discussion in 'ASP .Net' started by Hiten, Aug 22, 2006.

  1. Hiten

    Hiten Guest

    Is it possible to have more code behind file but that file will have
    same class in way of partial class,
    Default

    Structure I
    --------------
    Homepage.aspx
    + Homepage.aspx.cs (this .cs file will have "Homepage" class
    which is partial)

    Can we have more file in code behind which has partial implementation
    of the same Class

    Structure II
    ----------------
    Homepage.aspx
    + Homepage1.aspx.cs (this .cs file will have "Homepage" class
    which is partial)
    + Homepage2.aspx.cs (this .cs file will have "Homepage" class
    which is partial)
    + Homepage3.aspx.cs (this .cs file will have "Homepage" class
    which is partial)

    Is above Structure II is possible in Asp.Net??
    Hiten, Aug 22, 2006
    #1
    1. Advertising

  2. Hiten,
    This is not really what Partial Classes are designed for in ASP.NET - they
    are really for keeping the Designer - generated control code separate from
    your Page class' business logic code.

    It looks like what you really are after is a Base Page class that other Page
    classes derive from - inheritance.
    Peter

    --
    Co-founder, Eggheadcafe.com developer portal:
    http://www.eggheadcafe.com
    UnBlog:
    http://petesbloggerama.blogspot.com




    "Hiten" wrote:

    > Is it possible to have more code behind file but that file will have
    > same class in way of partial class,
    > Default
    >
    > Structure I
    > --------------
    > Homepage.aspx
    > + Homepage.aspx.cs (this .cs file will have "Homepage" class
    > which is partial)
    >
    > Can we have more file in code behind which has partial implementation
    > of the same Class
    >
    > Structure II
    > ----------------
    > Homepage.aspx
    > + Homepage1.aspx.cs (this .cs file will have "Homepage" class
    > which is partial)
    > + Homepage2.aspx.cs (this .cs file will have "Homepage" class
    > which is partial)
    > + Homepage3.aspx.cs (this .cs file will have "Homepage" class
    > which is partial)
    >
    > Is above Structure II is possible in Asp.Net??
    >
    >
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=, Aug 22, 2006
    #2
    1. Advertising

  3. Hiten

    Hiten Guest

    Hi Peter

    I agree with you but lets have example if i have ASPX page it has so
    many controls on page and according to that there are many code at code
    behind now to divide these codes in files by keeping same class we can
    go for partial class and achieve that,
    So my question is that only how do I do that?

    Thanks


    Peter wrote:

    > Hiten,
    > This is not really what Partial Classes are designed for in ASP.NET - they
    > are really for keeping the Designer - generated control code separate from
    > your Page class' business logic code.
    >
    > It looks like what you really are after is a Base Page class that other Page
    > classes derive from - inheritance.
    > Peter
    >
    > --
    > Co-founder, Eggheadcafe.com developer portal:
    > http://www.eggheadcafe.com
    > UnBlog:
    > http://petesbloggerama.blogspot.com
    >
    >
    >
    >
    > "Hiten" wrote:
    >
    > > Is it possible to have more code behind file but that file will have
    > > same class in way of partial class,
    > > Default
    > >
    > > Structure I
    > > --------------
    > > Homepage.aspx
    > > + Homepage.aspx.cs (this .cs file will have "Homepage" class
    > > which is partial)
    > >
    > > Can we have more file in code behind which has partial implementation
    > > of the same Class
    > >
    > > Structure II
    > > ----------------
    > > Homepage.aspx
    > > + Homepage1.aspx.cs (this .cs file will have "Homepage" class
    > > which is partial)
    > > + Homepage2.aspx.cs (this .cs file will have "Homepage" class
    > > which is partial)
    > > + Homepage3.aspx.cs (this .cs file will have "Homepage" class
    > > which is partial)
    > >
    > > Is above Structure II is possible in Asp.Net??
    > >
    > >
    Hiten, Aug 23, 2006
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Paolo Pignatelli
    Replies:
    6
    Views:
    2,165
    Paolo Pignatelli
    Feb 21, 2005
  2. Anders S. Willumsen

    Partial class and code behind in asp.net2

    Anders S. Willumsen, Jul 31, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    1,987
    Scott Allen
    Aug 1, 2005
  3. =?Utf-8?B?Q3VydF9DIFtNVlBd?=

    RE: One code behind file and multiple ASPX pages?

    =?Utf-8?B?Q3VydF9DIFtNVlBd?=, Sep 7, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    425
    =?Utf-8?B?Q3VydF9DIFtNVlBd?=
    Sep 7, 2005
  4. =?Utf-8?B?TWU=?=

    One code behind file and multiple ASPX pages?

    =?Utf-8?B?TWU=?=, Sep 7, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    912
    Craig Deelsnyder
    Sep 7, 2005
  5. Billy
    Replies:
    2
    Views:
    487
    Billy
    Feb 1, 2006
Loading...

Share This Page