Usercontrol vs Custom Server Controls, Any need for Custom Server Controls

Hello

I'm new to ASP.Net so this is probably a stupid question but, is there any need to create customer server controls now that you can pre-compile usercontrols into a dll and thus easily share between applications?

This blog post from David Ebb describes how to do it and the restrictions he note don't seem that bad (other than being able to embed resources such as images in the dll). http://blogs.msdn.com/davidebb/archive/2005/10/30/487160.aspx

His article desribes the techniques for ASP.Net 2.0 and he suggests that there will be further improvements in .Net 3.5 in this area. Does anyone know about these?

Cheers

G

 

0
grazza98
3/16/2009 10:57:37 AM
📁 asp.net.web-forms
📃 93655 articles.
⭐ 6 followers.

💬 3 Replies
👁️‍🗨️ 1974 Views

Hi,

UserControls, precompiled or not, are reusable groups of pre-existing controls (and relative business logic).

This is fine in most cases.

But there are times when you need a type of control that is not included in the framework. (eg. chart control, graphic checkbox control, gauge control, etc.)

You may create it inheriting and customizing existing ones, or creating it from scratch, fully implementing its html rendering. I know, this are rare situations... but I would never say Custom Controls are no more useful...


=WereWolf=
--
MCPD
--
Helping someone does not mean giving them what they need, but making them able to get it themselves
--
The Code Golem http://www.codegolem.com/
0
WereWolf
3/16/2009 12:16:31 PM

Hi WereWolf

Thanks for your response. Right ok so, if you want to extend an exiting control, use a control(s) which can't be added to the Toolbox and/or fully control the html rendering then creating Custom Server controls is the way to go?

Otherwise you might as well just create a usercontrol?

Cheers

G

0
grazza98
3/16/2009 12:36:35 PM

Yes, I would say best practice is to project your solution using UserControls.

When your special needs can not be satisfied by UserControls, then think implementing Custom Controls.

The important thing is analyzing the requisites and choosing UserControl or CustomControl while projecting, not when you are already writing your code Wink

 

At least, this is how I am used to work.

Hope it helps. Bye!


=WereWolf=
--
MCPD
--
Helping someone does not mean giving them what they need, but making them able to get it themselves
--
The Code Golem http://www.codegolem.com/
0
WereWolf
3/16/2009 2:13:39 PM
Reply: