473,395 Members | 1,502 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,395 software developers and data experts.

ASP.Net 2.0 and partial classes

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 the global namespace which is called the same
way than your codebehind class and another class under ASP namespace which is
called the way you named your ASPX file (using underscores instead of dots).
It's not enough, it playces the files you created into it's temp folder. So
my is question is now, what is this for? I thought (read various articles
about the new features) that the partial class thing was invented to avoid
inheritance... Or am I wrong? Maybe I missunderstood something.

Could please someone enlight me?!

Thanks in advance
Patrick
Nov 19 '05 #1
7 1611
The partial class is generated by ASP.NET to declare all of the server side
controls that you've declared in your ASPX file. In v1.1 you had to manually
(or VS.NET had to) declare a field for every control you had on your page.
That is no longer nedded, as the ASP.NET compiler does this for you.

-Brock
DevelopMentor
http://staff.develop.com/ballen
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 the global namespace which
is called the same way than your codebehind class and another class
under ASP namespace which is called the way you named your ASPX file
(using underscores instead of dots). It's not enough, it playces the
files you created into it's temp folder. So my is question is now,
what is this for? I thought (read various articles about the new
features) that the partial class thing was invented to avoid
inheritance... Or am I wrong? Maybe I missunderstood something.

Could please someone enlight me?!

Thanks in advance
Patrick


Nov 19 '05 #2
Except even a neophyte like me knows the narrow minded morons that designed
partial classes apparently still require a developer to make many trips back
to the Designer where he or she must select a control and scroll, scroll,
scroll the boat gently down the stream just to review the control's
properites in the Properties Window each time the initial properties are
needed for reference.

What was the name of that control again? Back to the Designer to scroll,
scroll, scroll the boat.
What a serious waste of time. In this context the implementation is FUBAR

I tried submitting to MSDN Product Feedback long ago suggesting a #region in
the partial class using commented signatures for each control.
If you agree my suggestion is the right way to implement references for
control signatures please say so at MSDN Product Feedback [1] before they go
RTM.

<%= Clinton Gallagher
METROmilwaukee (sm) "A Regional Information Service"
NET csgallagher AT metromilwaukee.com
URL http://metromilwaukee.com/
URL http://clintongallagher.metromilwaukee.com/

[1] http://lab.msdn.microsoft.com/Produc...k/Default.aspx
"Brock Allen" <ba****@NOSPAMdevelop.com> wrote in message
news:54**********************@msnews.microsoft.com ...
The partial class is generated by ASP.NET to declare all of the server
side controls that you've declared in your ASPX file. In v1.1 you had to
manually (or VS.NET had to) declare a field for every control you had on
your page. That is no longer nedded, as the ASP.NET compiler does this for
you.

-Brock
DevelopMentor
http://staff.develop.com/ballen
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 the global namespace which
is called the same way than your codebehind class and another class
under ASP namespace which is called the way you named your ASPX file
(using underscores instead of dots). It's not enough, it playces the
files you created into it's temp folder. So my is question is now,
what is this for? I thought (read various articles about the new
features) that the partial class thing was invented to avoid
inheritance... Or am I wrong? Maybe I missunderstood something.

Could please someone enlight me?!

Thanks in advance
Patrick


Nov 19 '05 #3
It would be even cooler if the IDE supported Ctrl-s(ignature) at the
insertion point which would return Intellisense with a list of signatures
for controls in the page.

<%= Clinton Gallagher


"clintonG" <cs*********@REMOVETHISTEXTmetromilwaukee.com> wrote in message
news:uB****************@TK2MSFTNGP09.phx.gbl...
Except even a neophyte like me knows the narrow minded morons that
designed partial classes apparently still require a developer to make many
trips back to the Designer where he or she must select a control and
scroll, scroll, scroll the boat gently down the stream just to review the
control's properites in the Properties Window each time the initial
properties are needed for reference.

What was the name of that control again? Back to the Designer to scroll,
scroll, scroll the boat.
What a serious waste of time. In this context the implementation is FUBAR

I tried submitting to MSDN Product Feedback long ago suggesting a #region
in the partial class using commented signatures for each control.
If you agree my suggestion is the right way to implement references for
control signatures please say so at MSDN Product Feedback [1] before they
go RTM.

<%= Clinton Gallagher
METROmilwaukee (sm) "A Regional Information Service"
NET csgallagher AT metromilwaukee.com
URL http://metromilwaukee.com/
URL http://clintongallagher.metromilwaukee.com/

[1] http://lab.msdn.microsoft.com/Produc...k/Default.aspx
"Brock Allen" <ba****@NOSPAMdevelop.com> wrote in message
news:54**********************@msnews.microsoft.com ...
The partial class is generated by ASP.NET to declare all of the server
side controls that you've declared in your ASPX file. In v1.1 you had to
manually (or VS.NET had to) declare a field for every control you had on
your page. That is no longer nedded, as the ASP.NET compiler does this
for you.

-Brock
DevelopMentor
http://staff.develop.com/ballen
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 the global namespace which
is called the same way than your codebehind class and another class
under ASP namespace which is called the way you named your ASPX file
(using underscores instead of dots). It's not enough, it playces the
files you created into it's temp folder. So my is question is now,
what is this for? I thought (read various articles about the new
features) that the partial class thing was invented to avoid
inheritance... Or am I wrong? Maybe I missunderstood something.

Could please someone enlight me?!

Thanks in advance
Patrick



Nov 19 '05 #4
Why doesn't typing "this." work?

-Brock
DevelopMentor
http://staff.develop.com/ballen
It would be even cooler if the IDE supported Ctrl-s(ignature) at the
insertion point which would return Intellisense with a list of
signatures for controls in the page.

<%= Clinton Gallagher

"clintonG" <cs*********@REMOVETHISTEXTmetromilwaukee.com> wrote in
message news:uB****************@TK2MSFTNGP09.phx.gbl...
Except even a neophyte like me knows the narrow minded morons that
designed partial classes apparently still require a developer to make
many trips back to the Designer where he or she must select a control
and scroll, scroll, scroll the boat gently down the stream just to
review the control's properites in the Properties Window each time
the initial properties are needed for reference.

What was the name of that control again? Back to the Designer to
scroll,
scroll, scroll the boat.
What a serious waste of time. In this context the implementation is
FUBAR
I tried submitting to MSDN Product Feedback long ago suggesting a
#region
in the partial class using commented signatures for each control.
If you agree my suggestion is the right way to implement references
for
control signatures please say so at MSDN Product Feedback [1] before
they
go RTM.
<%= Clinton Gallagher
METROmilwaukee (sm) "A Regional Information Service"
NET csgallagher AT metromilwaukee.com
URL http://metromilwaukee.com/
URL http://clintongallagher.metromilwaukee.com/
[1] http://lab.msdn.microsoft.com/Produc...k/Default.aspx

"Brock Allen" <ba****@NOSPAMdevelop.com> wrote in message
news:54**********************@msnews.microsoft.com ...
The partial class is generated by ASP.NET to declare all of the
server side controls that you've declared in your ASPX file. In v1.1
you had to manually (or VS.NET had to) declare a field for every
control you had on your page. That is no longer nedded, as the
ASP.NET compiler does this for you.

-Brock
DevelopMentor
http://staff.develop.com/ballen
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 the global
namespace which is called the same way than your codebehind class
and another class under ASP namespace which is called the way you
named your ASPX file (using underscores instead of dots). It's not
enough, it playces the files you created into it's temp folder. So
my is question is now, what is this for? I thought (read various
articles about the new features) that the partial class thing was
invented to avoid inheritance... Or am I wrong? Maybe I
missunderstood something.

Could please someone enlight me?!

Thanks in advance
Patrick


Nov 19 '05 #5
Hi Brock,

thanks for your reply.

So I guess I missunderstood the following lines:

"Coding Models in ASP.NET 2.0

ASP.NET 2.0 continues to offer both the code-inline and code-behind coding
models. In terms of the code-inline model, very little has changed except for
the way that Microsoft Visual Studio 2005 supports single-file development.
For more details on changes in Visual Studio 2005 and how it handles
code-inline, see this article.

ASP.NET 2.0 addresses both the inheritance and compilation concerns of the
code-behind model by modifying the nature of the code-behind file. In ASP.NET
2.0, the code-behind file is no longer a full implementation of the
System.Web.UI.Page class. Instead, the code-behind file is a new construct
called a partial class. The partial class contains all of the user-defined
code, but omits all of the plumbing and connectivity code that was
auto-generated by Visual Studio .NET in ASP.NET 1.x. When an ASPX page with a
new code-behind file is requested, the ASP.NET 2.0 runtime will actually
combine the ASPX page and the partial class into a single class, rather than
two separate classes. "

You find the complete article here:
http://msdn.microsoft.com/asp.net/be.../internals.asp

Regards
Patrick

"Brock Allen" wrote:
The partial class is generated by ASP.NET to declare all of the server side
controls that you've declared in your ASPX file. In v1.1 you had to manually
(or VS.NET had to) declare a field for every control you had on your page.
That is no longer nedded, as the ASP.NET compiler does this for you.

-Brock
DevelopMentor
http://staff.develop.com/ballen
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 the global namespace which
is called the same way than your codebehind class and another class
under ASP namespace which is called the way you named your ASPX file
(using underscores instead of dots). It's not enough, it playces the
files you created into it's temp folder. So my is question is now,
what is this for? I thought (read various articles about the new
features) that the partial class thing was invented to avoid
inheritance... Or am I wrong? Maybe I missunderstood something.

Could please someone enlight me?!

Thanks in advance
Patrick


Nov 19 '05 #6
> ASP.NET 2.0 continues to offer both the code-inline and code-behind
coding models. In terms of the code-inline model, very little has
changed except for the way that Microsoft Visual Studio 2005 supports
single-file development. For more details on changes in Visual Studio
2005 and how it handles code-inline, see this article.
I just think this means for a single file ASPX page there's now proper intellisense
in VS.NET. In v1.1 you couold do all of your layout and code in a single
ASPX file, it's just that it was painful to do. Now VS.NET gives full intellisense,
which is a godsend.
ASP.NET 2.0 addresses both the inheritance and compilation concerns of
the code-behind model by modifying the nature of the code-behind file.
In ASP.NET 2.0, the code-behind file is no longer a full
implementation of the System.Web.UI.Page class. Instead, the
code-behind file is a new construct called a partial class. The
partial class contains all of the user-defined code, but omits all of
the plumbing and connectivity code that was auto-generated by Visual
Studio .NET in ASP.NET 1.x. When an ASPX page with a new code-behind
file is requested, the ASP.NET 2.0 runtime will actually combine the
ASPX page and the partial class into a single class, rather than two
separate classes. "


This is for codebehind. Any time you declare a control in your ASPX that
you want to use in your codebehind you need to have that variable declared.
The reason is because the codebehind is a base class to the ASPX file. So
it's necessary to declare the control in the base class so it can operate
(and compile, of course) on the control. This was a manual process v1.1 and
VS.NET helped somewhat in this. Now in v2.0 ASP.NET dynamically adds a partial
to the base class and all this partial has is the control declarations --
just like you'd had in v1.1.

So, at the end of the day, ASP.NET is really no different in its inheritance
model, but the mechanics of how you get those classes is slightly different.

FWIW, I personally dislike the inheritance model. It was essentially mandatory
in v1.1 given how VS.NET worked, but now that there's full intellisense support
in a single ASPX file in v2.0, I'll be doing all my pages that way. Goodbye
to codebehind :)

-Brock
DevelopMentor
http://staff.develop.com/ballen

Nov 19 '05 #7
Son of a gum I learn something new everyday. Thanks for helpimg me feel
stoopit ;-)

<%= Clinton Gallagher

"Brock Allen" <ba****@NOSPAMdevelop.com> wrote in message
news:54**********************@msnews.microsoft.com ...
Why doesn't typing "this." work?

-Brock
DevelopMentor
http://staff.develop.com/ballen
It would be even cooler if the IDE supported Ctrl-s(ignature) at the
insertion point which would return Intellisense with a list of
signatures for controls in the page.

<%= Clinton Gallagher

"clintonG" <cs*********@REMOVETHISTEXTmetromilwaukee.com> wrote in
message news:uB****************@TK2MSFTNGP09.phx.gbl...
Except even a neophyte like me knows the narrow minded morons that
designed partial classes apparently still require a developer to make
many trips back to the Designer where he or she must select a control
and scroll, scroll, scroll the boat gently down the stream just to
review the control's properites in the Properties Window each time
the initial properties are needed for reference.

What was the name of that control again? Back to the Designer to
scroll,
scroll, scroll the boat.
What a serious waste of time. In this context the implementation is
FUBAR
I tried submitting to MSDN Product Feedback long ago suggesting a
#region
in the partial class using commented signatures for each control.
If you agree my suggestion is the right way to implement references
for
control signatures please say so at MSDN Product Feedback [1] before
they
go RTM.
<%= Clinton Gallagher
METROmilwaukee (sm) "A Regional Information Service"
NET csgallagher AT metromilwaukee.com
URL http://metromilwaukee.com/
URL http://clintongallagher.metromilwaukee.com/
[1] http://lab.msdn.microsoft.com/Produc...k/Default.aspx

"Brock Allen" <ba****@NOSPAMdevelop.com> wrote in message
news:54**********************@msnews.microsoft.com ...

The partial class is generated by ASP.NET to declare all of the
server side controls that you've declared in your ASPX file. In v1.1
you had to manually (or VS.NET had to) declare a field for every
control you had on your page. That is no longer nedded, as the
ASP.NET compiler does this for you.

-Brock
DevelopMentor
http://staff.develop.com/ballen
> 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 the global
> namespace which is called the same way than your codebehind class
> and another class under ASP namespace which is called the way you
> named your ASPX file (using underscores instead of dots). It's not
> enough, it playces the files you created into it's temp folder. So
> my is question is now, what is this for? I thought (read various
> articles about the new features) that the partial class thing was
> invented to avoid inheritance... Or am I wrong? Maybe I
> missunderstood something.
>
> Could please someone enlight me?!
>
> Thanks in advance
> Patrick


Nov 19 '05 #8

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

Similar topics

9
by: Gomaw Beoyr | last post by:
Two question about the "partial classes" (in the next wersion of ..NET). Question 1 ========== Will partial classes (in the next version of C#) have to be declared "partial" in ALL places. ...
16
by: Madhuri Mittal | last post by:
Hi, I know that we can define a class over multiple source files using the keyword 'Partial' in C# within a project. Can we define the class over multiple projects using the 'Patial' keyword- I...
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...
1
by: Bishoy George | last post by:
In a web application using asp.net 2.0 All my classes are partial classes. - I noticed that partial class cannot be inherited... is that true? - I tried to remove the partial keyword , and I...
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,...
2
by: PeterKellner | last post by:
I'm trying to understand how asp.net 2.0 ties together the codebehind. I've made a simple page, turned debug on so the *0.cs,*1.cs,*2.cs files don't get erased. My first point of confusion is...
2
by: Sebastian | last post by:
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...
3
by: vivekian | last post by:
Hi, Is there a way to have partial classes across different namespaces ? namespace a.b.c { public partial class X { private void MyMethod () { } }
5
by: Sagar | last post by:
I am working on a migration project for a huge asp.net application now running in framwework 1.1 to dotnet 2.0 As a first step, I opened the .sln files of the project in VS.Net 2005. The...
2
by: Peted | last post by:
Hi, im moving a project from vs2005 to vs 2008. is doing so i have come across a compiler error regarding partial classes that i dont understand if anyone can explain it to me please the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.