Cambia Research - Supporting the Microsoft .NET Developer Community Supporting the Microsoft .NET Developer Community  

     | Home  | Articles  | Categories  | Coders  | Search  | Submit  | Contact Us    
When you start off by telling those who disagree with you that they are not merely in error but in sin, how much of a dialogue do you expect? --Thomas Sowell

Share Your Knowledge! -- Create and submit your articles the easy way with WebWriter.

Updated:04:09 PM CT May 26, 2007
Posted:02:17 PM CT May 26, 2007

Where can I view the partial class with designer code in my ASP.NET project?

The partial class concept in Visual Studio 2005 ASP.NET projects

Author: Steve Lautenschlager

ReferenceVisual StudioVS 2005.NET 2.0ASP.NET

 Summary

PROBLEM: In my ASP.NET 2.0 project I want to change some default settings for my designer objects like I used to in ASP.NET 1.1, but I can't find the partial class file that's supposed to have all the designer settings. Dawgonnit!
Sorry, it's a trick question. If you're new to .NET 2.0, then you are discovering partial classes for the first time. Partial classes allow one class definition to span more than one file. For a general overview, visit my introductory article on partial classes.

In Windows Forms, the designer code is generated in a separate partial class so that you don't have to deal with it in the file where you are adding most of your code.

However, in ASP.NET the partial class with the designer code doesn't actually exist. It is generated at runtime. This is nice in the sense that you don't have to deal with all the designer code in your code-behind file (which is also a partial class now). However, it's bad in the sense that you can no longer see your object declarations. For example, if you drop a Label onto a web form, the declaration will not show up in your code-behind file. Intellisense will still have it though. If you can't remember the name of your Label object, you'll have to go back to design view or scroll through intellisense.

So, to answer the question, you can't find your partial class with designer code because it doesn't exist until runtime.

Now isn't that a relief.

Add New Comment
CR Comments by Cambia Research
advertisement
 
Steve Lautenschlager (steve)
Steve is the founder and creator of Cambia Research. Developing and maintaining the site combines his passions for technology, writing and education.
Steve holds a Ph.D. in particle physics from Duke University, has worked at CERN, the European center for particle physics (where the web was born) and in Microsoft's web division with microsoft.com, msnbc.com and other web properties. Steve is a web consultant specializing in Microsoft.NET technologies. Read more here.


 
Copyright © Cambia Research 2002-2007. All Rights Reserved. steve [ at ] cambiaresearch.com