473,406 Members | 2,849 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,406 software developers and data experts.

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!
Dec 31 '05 #1
1 3001
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

--
MY ASP.Net tutorials
http://www.openmymind.net/
http://openmymind.net/redirector.aspx?documentId=51 - Learn about AJAX!

"balystyk" <ba******@discussions.microsoft.com> wrote in message
news:0E**********************************@microsof t.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!

Dec 31 '05 #2

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

Similar topics

4
by: Chris | last post by:
I have a question on whether or not this is good practice. I have a fairly complex web user control (a datalist embedded in a datalist with lots of controls) that I will call Usercontrol1 and a...
11
by: DrUg13 | last post by:
In java, this seems so easy. You need a new object Object test = new Object() gives me exactly what I want. could someone please help me understand the different ways to do the same thing in...
14
by: 42 | last post by:
Hi, Stupid question: I keep bumping into the desire to create classes and properties with the same name and the current favored naming conventions aren't automatically differentiating them......
3
by: Furty | last post by:
Hi, I'm looking for the best practice for creating a generic data validation implementation for my data bound business objects. I currently have a business object base class implementing the...
16
by: Rex | last post by:
Hi All - I have a question that I think MIGHT be of interest to a number of us developers. I am somewhat new to VIsual Studio 2005 but not new to VB. I am looking for ideas about quick and...
5
by: gw7rib | last post by:
I'm writing a program which has "notes" - these can appear on the screen as windows with text in. It is possible to create an "index note" - at present, this will contain a list of the titles (or...
4
by: =?Utf-8?B?bW9mbGFoZXJ0eQ==?= | last post by:
In VB6, we created a number of ActiveX DLLs that all shared a similar interface. The main application would load these in dynamically (late-bound.) This worked well for our situation because we...
7
by: Steve | last post by:
I am building an object library for tables in a database. What is the best practice for creating objects like this? For example, say I have the following tables in my database: User: - Id -...
4
by: Rod Person | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I've been doing python programming for about 2 years as a hobby and now I'm finally able to use it at work in an enterprise environment. Since I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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
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,...
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,...
0
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...
0
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,...
0
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...

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.