473,320 Members | 1,817 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Multiple Partial class file in aspx code behind file?

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??

Aug 22 '06 #1
2 2307
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??

Aug 22 '06 #2
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??
Aug 23 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

43
by: nospam | last post by:
I got three (3) files (1) Untitled.aspx (2) Untitled.aspx.1.cs (3) Untitled.aspx.2.cs These three files must be used together to make file #1, Untitled.aspx, page work via J.I.T. when the...
7
by: Patrick | last post by:
Hi all, I was playing around with ASP.Net 2.0 and recognized that in case you use Code-Behind/Beside (how is it called in future?) the parser still creates TWO classes one partial class under...
16
by: pawel.pabich | last post by:
Hajo, I would like to have 2 my own partial classes. For example: Default.aspx.cs Default2.aspx.cs and they both will relate to Default.aspx page.
10
by: ptass | last post by:
Hi In asp.net 2.0 an aspx files .cs file is a partial class and all works fine, however, I thought I’d be able to create another class file, call it a partial class and have that compile and...
5
by: Michael | last post by:
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 :...
11
by: Ranginald | last post by:
This question is about how to handle an .aspx page that references multiple methods and where to store these methods (e.g. one codefile or multiple codefiles). PREFACE ======== I have a simple...
9
by: Fat Elvis | last post by:
I'd like to extend some of my Asp.net pages by using Partial Classes. Example ASP.Net Page: public partial class Admin_Customer : System.Web.UI.Page { protected void Page_Load(object sender,...
6
by: =?Utf-8?B?QWxleA==?= | last post by:
I upgraded a 2003 solution into a Web Application Project. When I converted one of the forms to a partial class, the page_load event isn't executing anymore. Is there anything else I need to do in...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.