473,614 Members | 2,377 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

partial classes

Hello,

I have come to like just about everything in VS2005 except for the
"partial class" feature. Sometimes when I add a control to a web form,
it is not referenced in the partial class [no Intellisense]. Before
VS2005 I could simply add my own reference, now I can't. Where can I
find the other "part" of the class? Or even better, is there a way to
disable this feature?

Thanks!
*** Sent via Developersdex http://www.developersdex.com ***
Oct 31 '06 #1
10 1961
On Oct 31, 2:50 pm, Phil Townsend <phil25...@gmai l.comwrote:
I have come to like just about everything in VS2005 except for the
"partial class" feature. Sometimes when I add a control to a web form,
it is not referenced in the partial class [no Intellisense]. Before
VS2005 I could simply add my own reference, now I can't. Where can I
Why can't you? When I add a web form to my web project, I can expand
the .aspx file by clicking the little plus sign and see the .aspx.cs
file. At the top of the Solution Explorer is a button called "Nest
related files". Does it help if you click that?
find the other "part" of the class? Or even better, is there a way to
disable this feature?
I'm not sure if there is a way to turn off partial classes, but you can
move all your code into a single file if that is what you want and then
just remove the partial declaration.

Chris

Nov 1 '06 #2
Thanks for the reply.

The problem I'm having is locating where the other "part" of the partial
class is. Where does VS put it? Thanks...

*** Sent via Developersdex http://www.developersdex.com ***
Nov 2 '06 #3
Phil Townsend wrote:
Thanks for the reply.

The problem I'm having is locating where the other "part" of the partial
class is. Where does VS put it? Thanks...
Physically it should be in the same folder as the .aspx file. So for
default.aspx, there should be a file called default.aspx.cs .

But like I said, just expand the node in the Solution Explorer and you
can get right to it.

Nov 2 '06 #4
Yes, I understand what you are saying. There is an aspx.cs file coupled
with the webform. However, it is only a "partial" class file. What I
need to know is where the other "part" of the aspx.cs file is stored. In
other words, there are two parts of the "partial" class. Whare are ALL
the various parts of the class [not the web form markup]? Thanks.

*** Sent via Developersdex http://www.developersdex.com ***
Nov 3 '06 #5
Phil Townsend wrote:
Yes, I understand what you are saying. There is an aspx.cs file coupled
with the webform. However, it is only a "partial" class file. What I
need to know is where the other "part" of the aspx.cs file is stored. In
other words, there are two parts of the "partial" class. Whare are ALL
the various parts of the class [not the web form markup]? Thanks.

*** Sent via Developersdex http://www.developersdex.com ***
For a web form, I don't think there *is* another part other than the
page itself. At the top of the .aspx file, you should see that the
page inherits the partial class. So that is one part of the class and
the aspx.cs file contains the other part of the class.

Nov 3 '06 #6
Let me rephrase what I am asking. Where are the definitions for the web
controls that are on the web form? Where are the event handlers defined?
They are NOT in the partial class that is visibly coupled with the
webform.

*** Sent via Developersdex http://www.developersdex.com ***
Nov 3 '06 #7

Phil Townsend wrote:
Let me rephrase what I am asking. Where are the definitions for the web
controls that are on the web form? Where are the event handlers defined?
They are NOT in the partial class that is visibly coupled with the
webform.
I assume you're asking if there is an equivalent in web forms of the
Windows Forms Form.Designer.c s file where all the variables are
instantiated and the events are wired up. I don't think there is.

The handlers will be in the aspx.cs file. To test this what I did was
to drag a button onto the web form. I then double clicked it.

In the .aspx page, it added an OnClick attribute to the asp:button
element.

In the .aspx.cs file it added this method:

protected void Button1_Click(o bject sender, EventArgs e)
{

}

I don't see any other code. I'm not sure if the code to wire up the
event handler is generated anywhere else (i.e. Button1.OnClick +=
Button1_Click;) . I don't think it is, but I may be mistaken. I'm
guessing that it is wired up by ASP.Net when the page is requested.

If there is another file somewhere, I am not aware of it. (Of course
that doesn't mean its not there!!).

Cheers,

Chris

Nov 3 '06 #8
Phil Townsend wrote:
Yes, I understand what you are saying. There is an aspx.cs file coupled
with the webform. However, it is only a "partial" class file. What I
need to know is where the other "part" of the aspx.cs file is stored. In
other words, there are two parts of the "partial" class. Whare are ALL
the various parts of the class [not the web form markup]? Thanks.
The code for the design is not visible in the file list, but you can get
to it eventhough.

If you search for the name of a control in the entire solution, you will
see that it's found not only in your .cs file, but also in a
..Designer.cs file. There's where the other part of the class is.
Nov 6 '06 #9

Göran Andersson wrote:
Phil Townsend wrote:
Yes, I understand what you are saying. There is an aspx.cs file coupled
with the webform. However, it is only a "partial" class file. What I
need to know is where the other "part" of the aspx.cs file is stored. In
other words, there are two parts of the "partial" class. Whare are ALL
the various parts of the class [not the web form markup]? Thanks.

The code for the design is not visible in the file list, but you can get
to it eventhough.

If you search for the name of a control in the entire solution, you will
see that it's found not only in your .cs file, but also in a
.Designer.cs file. There's where the other part of the class is.
In any of my VS2005 Web Sites, I can find NO instances of any file
called *.designer.cs. I don't think they exist.

Nov 7 '06 #10

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

Similar topics

43
2628
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 User first hits Internet Explorer 6.0 on your browser.
9
2513
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:
16
2636
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
2426
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 load as a 3rd partial class. This would be handy so i can generate standard code into one of the partial classes, while having my custom code untouched
1
2630
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
9
5776
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, EventArgs e) { Data_List(); } }
2
1418
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 code-behind classes into multiple files using partial classes? It would be helpfull to balance work on multiple developers working on same subject. I've already got it done in DLL-Projects (SQL-Helper, Builders, .... ) but how to do it in web-projects?
5
1369
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
2111
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......
10
1519
by: JDeats | last post by:
So I have a class that spans over two partial classes in code, here's an example (do not read much into this, the code is of no practical use, this is just a simple example of where my confusion occurs). // Inside SharedClassExample1.cs public partial class SharedClassExample { public List<stringBooksOnShelf { get; set; } public List<stringBooksOnDesk { get; set; }
0
8176
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
8120
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8620
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8571
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
8265
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
8423
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4048
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
1705
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1420
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.