473,785 Members | 2,421 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

2005 - Partial Classes

In 2003, we have a usercontrol that we reference as a type i.e. we can pass
the class around to functions to reference it. In 2005, the class is now
partial and doesn't seem to let you reference it as a type anymore, is there
a way around this ?

Thanks
Adrian
Nov 19 '05 #1
7 1035
Can you provide a code example?

I am not 100% sure I understand what you mean. Partial classes or not, the
end result is a referenceable type.

--
- Paul Glavich
MVP ASP.NET
http://weblogs.asp.net/pglavich
ASPInsiders member - http://www.aspinsiders.com
"Adrian Parker" <ap******@nospa m.nospam> wrote in message
news:eV******** ******@tk2msftn gp13.phx.gbl...
In 2003, we have a usercontrol that we reference as a type i.e. we can
pass the class around to functions to reference it. In 2005, the class is
now partial and doesn't seem to let you reference it as a type anymore, is
there a way around this ?

Thanks
Adrian

Nov 19 '05 #2
I'm not sure what you're asking. What do you mean by "doesn't seem to let
you reference it as a type anymore?"

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Everybody picks their nose,
But some people are better at hiding it.

"Adrian Parker" <ap******@nospa m.nospam> wrote in message
news:eV******** ******@tk2msftn gp13.phx.gbl...
In 2003, we have a usercontrol that we reference as a type i.e. we can
pass the class around to functions to reference it. In 2005, the class is
now partial and doesn't seem to let you reference it as a type anymore, is
there a way around this ?

Thanks
Adrian

Nov 19 '05 #3
On Thu, 4 Aug 2005 22:07:44 +1000, "Paul Glavich [MVP ASP.NET]"
<gl**@aspallian ce.com-NOSPAM> wrote:
Can you provide a code example?

I am not 100% sure I understand what you mean. Partial classes or not, the
end result is a referenceable type.

Not for user controls, web forms, and master pages. We have to take
some extra steps to reference those types in 2.0.

--
Scott
http://www.OdeToCode.com/blogs/scott/
Nov 19 '05 #4
It depends on where you try to reference the type from....

A user control (and it's code behind) will compile into a distinct
assembly that is not referenced by any other code in a web
application.

To put a reference in place from a web form you can use an @ Reference
directive, e.g. <%@ Reference VirtualPath="~/MyUserControl.a scx" %>.

If you need to interact with the user control from a class in App_Code
you'll have to create a stub class or an interface in App_Code and
derive your user control from the stub.

I've written some information about these types of scenarios in the
following:

One More On ASP.NET 2.0 Compilation
http://odetocode.com/Blogs/scott/arc...6/30/1889.aspx

Page Controllers and Stand-alone Code Migration
http://odetocode.com/Blogs/scott/arc...8/01/2030.aspx

Precompilation In ASP.NET 2.0
http://odetocode.com/Articles/417.aspx

When Deployment Gets Ugly
http://odetocode.com/Blogs/scott/arc...6/29/1882.aspx

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Thu, 4 Aug 2005 08:45:15 +0100, "Adrian Parker"
<ap******@nospa m.nospam> wrote:
In 2003, we have a usercontrol that we reference as a type i.e. we can pass
the class around to functions to reference it. In 2005, the class is now
partial and doesn't seem to let you reference it as a type anymore, is there
a way around this ?

Thanks
Adrian


Nov 19 '05 #5
Ok, we just put our 2003 files in a new area and opened up the project, it
went through a conversion process. We have many user controls that call
other functions passing references to themselves. The other functions have
a parameter of the usercontrol class type. That no longer works.
"Kevin Spencer" <ke***@DIESPAMM ERSDIEtakempis. com> wrote in message
news:eR******** *****@TK2MSFTNG P15.phx.gbl...
I'm not sure what you're asking. What do you mean by "doesn't seem to let
you reference it as a type anymore?"

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Everybody picks their nose,
But some people are better at hiding it.

"Adrian Parker" <ap******@nospa m.nospam> wrote in message
news:eV******** ******@tk2msftn gp13.phx.gbl...
In 2003, we have a usercontrol that we reference as a type i.e. we can
pass the class around to functions to reference it. In 2005, the class
is now partial and doesn't seem to let you reference it as a type
anymore, is there a way around this ?

Thanks
Adrian


Nov 19 '05 #6
Thanks for the links Scott,

I'm not looking forward to changing our app to make this work.. it seems
like a step backwards.
"Scott Allen" <sc***@nospam.o detocode.com> wrote in message
news:cp******** *************** *********@4ax.c om...
It depends on where you try to reference the type from....

A user control (and it's code behind) will compile into a distinct
assembly that is not referenced by any other code in a web
application.

To put a reference in place from a web form you can use an @ Reference
directive, e.g. <%@ Reference VirtualPath="~/MyUserControl.a scx" %>.

If you need to interact with the user control from a class in App_Code
you'll have to create a stub class or an interface in App_Code and
derive your user control from the stub.

I've written some information about these types of scenarios in the
following:

One More On ASP.NET 2.0 Compilation
http://odetocode.com/Blogs/scott/arc...6/30/1889.aspx

Page Controllers and Stand-alone Code Migration
http://odetocode.com/Blogs/scott/arc...8/01/2030.aspx

Precompilation In ASP.NET 2.0
http://odetocode.com/Articles/417.aspx

When Deployment Gets Ugly
http://odetocode.com/Blogs/scott/arc...6/29/1882.aspx

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Thu, 4 Aug 2005 08:45:15 +0100, "Adrian Parker"
<ap******@nospa m.nospam> wrote:
In 2003, we have a usercontrol that we reference as a type i.e. we can
pass
the class around to functions to reference it. In 2005, the class is now
partial and doesn't seem to let you reference it as a type anymore, is
there
a way around this ?

Thanks
Adrian

Nov 19 '05 #7
Sounds like you need the stub approach then.

The RTM version of 2005 should successfully migrate this code, but
like I say in the second link, you might be able to come up with an
eloquent solution on your own and decouple the controls from the
algorithms a bit.

I know it takes some work.

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Thu, 4 Aug 2005 15:17:44 +0100, "Adrian Parker"
<ap******@nospa m.nospam> wrote:
Thanks for the links Scott,

I'm not looking forward to changing our app to make this work.. it seems
like a step backwards.
"Scott Allen" <sc***@nospam.o detocode.com> wrote in message
news:cp******* *************** **********@4ax. com...
It depends on where you try to reference the type from....

A user control (and it's code behind) will compile into a distinct
assembly that is not referenced by any other code in a web
application.

To put a reference in place from a web form you can use an @ Reference
directive, e.g. <%@ Reference VirtualPath="~/MyUserControl.a scx" %>.

If you need to interact with the user control from a class in App_Code
you'll have to create a stub class or an interface in App_Code and
derive your user control from the stub.

I've written some information about these types of scenarios in the
following:

One More On ASP.NET 2.0 Compilation
http://odetocode.com/Blogs/scott/arc...6/30/1889.aspx

Page Controllers and Stand-alone Code Migration
http://odetocode.com/Blogs/scott/arc...8/01/2030.aspx

Precompilation In ASP.NET 2.0
http://odetocode.com/Articles/417.aspx

When Deployment Gets Ugly
http://odetocode.com/Blogs/scott/arc...6/29/1882.aspx

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Thu, 4 Aug 2005 08:45:15 +0100, "Adrian Parker"
<ap******@nospa m.nospam> wrote:
In 2003, we have a usercontrol that we reference as a type i.e. we can
pass
the class around to functions to reference it. In 2005, the class is now
partial and doesn't seem to let you reference it as a type anymore, is
there
a way around this ?

Thanks
Adrian


Nov 19 '05 #8

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

Similar topics

9
2534
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. I.e. do we have to need to write:
9
1136
by: David | last post by:
Is Visual Studio .NET 2005 avaleble or it's only beta version on this time?
0
1167
by: Andrew Ducker | last post by:
VS 2005 uses Partial Classes to keep the designer-generated code separate from the user-created code. Obviously VS 2003 doesn't. However, when converting from 2003 to 2005, it doesn't split the code out into partial classes. Is there any way to do so automatically?
1
2637
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 receieved this error Error 1 Missing partial modifier on declaration of type 'NagyResearch.Q_A.Q.QuestionnairePage'; another partial declaration of this type exists D:\Web Sites\Local
5
1374
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 Conversion wizard created partial classes off the existing classes. Is partial classes mandatory in VS.Net 2005 or can I still work without having to live with partial classes ?
2
2128
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 orig defintion that compiles and runs fine in vs2005 is bellow......
0
9645
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10147
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10091
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8972
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7499
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4050
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2879
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.