|
.net
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Best practice for creating a user control base class in asp.net 2.Are there any possible issues with creating a base class (adding common
properties) for a user control using a class file and not a user control (.ascx and code-behind) in asp.net 2.0? I have successfully tested using a class that inherits UserControl and it seems like the best way to go but a co-worker read somewhere that you shouldn't use a base class for user controls but to only use another user control for the base class. This process seems sloppy to me since in the end you have an empty .ascx file that doesn't seem to do anything. Thanks! I use a base user control class....I'd like to see the article ur coworking
is refering to... Not that you asked, but this is the one I just wrote a couple days ago, i LOVE it: public abstract class DevelopmentUserControl : UserControl { #if DEBUG protected override void OnInit(System.EventArgs e) { CachePolicy.Duration = TimeSpan.FromSeconds(0); base.OnInit(e); } #endif } it uses the new programmatic caching in 2.0 to override the OutputCache while developing. I hate having output cache on while developing 'cuz most of the time you want to see changes right away. Any control which inherits from this class won't be cached while in DEBUG. When not in debug, the normal Outputcache behaviour takes over. Karl -- Show quoteMY ASP.Net tutorials http://www.openmymind.net/ http://openmymind.net/redirector.aspx?documentId=51 - Learn about AJAX! "balystyk" <balys***@discussions.microsoft.com> wrote in message news:0EDF4192-B70C-4C77-99EA-4B7807E3B600@microsoft.com... > Are there any possible issues with creating a base class (adding common > properties) for a user control using a class file and not a user control > (.ascx and code-behind) in asp.net 2.0? I have successfully tested using > a > class that inherits UserControl and it seems like the best way to go but a > co-worker read somewhere that you shouldn't use a base class for user > controls but to only use another user control for the base class. This > process seems sloppy to me since in the end you have an empty .ascx file > that > doesn't seem to do anything. > > Thanks!
Other interesting topics
|
|||||||||||||||||||||||