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

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 1014
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******@nospam.nospam> wrote in message
news:eV**************@tk2msftngp13.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******@nospam.nospam> wrote in message
news:eV**************@tk2msftngp13.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**@aspalliance.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.ascx" %>.

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******@nospam.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***@DIESPAMMERSDIEtakempis.com> wrote in message
news:eR*************@TK2MSFTNGP15.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******@nospam.nospam> wrote in message
news:eV**************@tk2msftngp13.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.odetocode.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.ascx" %>.

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******@nospam.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******@nospam.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.odetocode.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.ascx" %>.

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******@nospam.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
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. ...
9
by: David | last post by:
Is Visual Studio .NET 2005 avaleble or it's only beta version on this time?
0
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...
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...
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: 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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.